Created
October 26, 2011 18:17
-
-
Save jonathantneal/1317227 to your computer and use it in GitHub Desktop.
agnostic-html-shim.htc.html
This file contains 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
<PUBLIC:COMPONENT lightWeight="true"> | |
<PUBLIC:ATTACH EVENT="onreadystatechange" FOR="document" ONEVENT="shim()"> | |
<SCRIPT> | |
// an agnostic html shim | |
// it doesn't believe in any particular element... yet! | |
// usage: <style> body { *behavior: url(iepp.htc); } </style> or anything like that | |
// | |
function shim() { | |
// stop if we already believe | |
var doc = element.document;//, elem = doc.createElement('i'); elem.innerHTML = "<iii>"; if (elem.childNodes.length) return; | |
// search for the unbelievable | |
var shim = false, shimmed = {}, es = doc.getElementsByTagName('*'), l = es.length, i = -1, e; | |
// detect the unbelievable and begin to believe | |
while (++i < l && (e = es[i].nodeName)) if (e.substr(0,1) === '/' && !shimmed[e] && (shim = shimmed[e] = true)) doc.createElement(e.substr(1)); | |
// reconsider everything after any newfound belief | |
if (shim) doc.body.innerHTML = doc.body.innerHTML; | |
} | |
</SCRIPT> | |
</PUBLIC:COMPONENT> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm downloading skype to talk now.