Skip to content

Instantly share code, notes, and snippets.

@irobinson
Created November 18, 2011 20:29
Show Gist options
  • Save irobinson/1377662 to your computer and use it in GitHub Desktop.
Save irobinson/1377662 to your computer and use it in GitHub Desktop.
Positioning of various elements in the DOM in DNN 6.1.1
<html>
<head>
<!-- New API CSS (e.g. ClientResourceManager.RegisterStyleSheet) -->
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadCss"></asp:PlaceHolder>
<!-- New API JS (e.g. ClientResourceManager.RegisterScript)-->
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadJs"></asp:PlaceHolder>
<!-- "Old API" CSS (e.g. styles skin object)-->
<asp:placeholder id="CSS" runat="server" />
<!-- "Old API" JS (not sure if anything still uses this) -->
<asp:placeholder id="SCRIPTS" runat="server" />
</head>
<body>
<form> <!-- ASP.NET stuff gets dynamically prepended to the form, so it goes before our explicit placeholder. -->
<!-- new API JS "top of the form" location. explicit placeholder. first thing inside form. -->
<asp:PlaceHolder ID="BodySCRIPTS" runat="server" />
[....skin and everything inside it goes here...]
<!-- two old school DNN variables -->
<input id="ScrollTop" runat="server" name="ScrollTop" type="hidden" />
<input id="__dnnVariable" runat="server" name="__dnnVariable" type="hidden" />
<!-- the last location for the New API, for stuff that needs to load at the bottom -->
<asp:placeholder runat="server" ID="ClientResourcesFormBottom" />
<form>
</body>
</html>
@irobinson
Copy link
Author

Right now framework level files (jQuery and jQuery UI) are loaded in the head, to ensure that everything in the body, no matter where, can use them. However, we may want to examine other resources to see if they qualify as "framework level" - like the new jQuery plugins should also be loaded in the head perhaps?

@irobinson
Copy link
Author

Additionally, there is an issue where things that use the ASP.NET JS registration methods are dynamically prepended to the form body, this creates a situation where library/utility methods can be registered (in BodySCRIPTS) and the JS that consumes them can be loaded before. Hmmmm....

@irobinson
Copy link
Author

But, keeping in mind that file combination is done on a "per-location" basis, and we already have three locations. Should we really break it down even further?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment