Modernizer adds a lot of classes to the <html>
tag, and one of those classes is js
. I couldn't find anything in the documentation that describes what that represents, although I suspect it just represents JavaScript support. Google has minified their classes, so they are all short two letter items (probably generated). One of them happens to be js
as well, which is causing a lot of text to get centered.
In fact, to un-hose it, just remove the js
class from the <html>
tag after dynamically loading your script and it fixes itself.
Here's a fixed version:
function load(url,cb){var x=document.body.appendChild(document.createElement('script'));x.src=url;x.onload=function(){console.log("Dynamically loaded "+url);if(cb){cb();}};if(!cb){x.setAttribute('async','')}}
load("https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js",function(){var htmlElement = document.getElementsByTagName("html")[0]; htmlElement.className = htmlElement.className.replace
( /(?:^|\s)js(?!\S)/g , '' ); alert("Modernizr loaded");});