ahh. i pounded the initial answer out a little quickly. i usually put attribs on the <HTML> element.
Originally Posted by Old Pedant
this can enable a ton of customization to be done in css, based which page, which browser, which section, etc.
for example, in addition to the OP solution, imagine what you can do with:
this can deploy sectional nav, activate mobile rules, inject the page title into the footer, show content only on certain days of the week or months of the year, etc. all with just css and the above js.
var url = decodeURIComponent(location.search).toLowerCase();
de.setAttribute("url", url );
de.setAttribute("lab", document.title );
de.setAttribute("dt", new Date().toUTCString() );
many if not all of the attribs above can also be easily applied by the server if supporting non-js clients is important. this lets you recycle more code while supporting backwards browsers, a win-win.