Created
May 4, 2010 13:13
-
-
Save phiggins42/389394 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Do Nothing.</title> | |
</head> | |
<body> | |
<script> | |
(function(){ | |
// some boilerplate load-a-script-code | |
var d = document, head = d.getElementsByTagName("head")[0], | |
s = d.createElement("script"); | |
s.src = "http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"; | |
s.onload = s.onreadystatechange = function(e){ | |
if(e && e.type == "load" || /loaded|complete/.test(s.readyState)){ | |
s.onload = s.onreadystatechange = null; | |
dojo.ready(init); // ensure DOM ready too | |
} | |
} | |
head.appendChild(s); | |
var init = function(){ | |
// stuff to do when dojo is loaded (and the DOM, too) | |
console.log("We're cool."); | |
} | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change
head = d.getElementsByTagName('head')[0]
intohead = d.head || d.getElementsByTagName('head')[0]
for added HTML5 buzzwordness. Or not.