Created
December 29, 2010 15:45
-
-
Save bebraw/758651 to your computer and use it in GitHub Desktop.
Shorter version of http://www.hagenburger.net/BLOG/Simple-HTML5-Fix-for-IE.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
// original | |
for(e,l='article aside footer header nav section time'.split(' ');e=l.pop();document.createElement(e)) | |
// original + moved pop | |
for(l='article aside footer header nav section time'.split(' ');;document.createElement(l.pop())) | |
// mine (not tested! might need some braces...) | |
// v1 (no globals) | |
var l=['article','aside','footer','header','nav','section','time'];for(var i in l)document.createElement(l[i]) | |
// v2 (globals) | |
l=['article','aside','footer','header','nav','section','time'];for(i in l)document.createElement(l[i]) |
True. Just figured out you can probably refactor "e" out of the original version. Just pop at createElement.
You may want to avoid endless loops.
Oh. Gotcha! Man, I need to test these things... :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For v1
l
will also be in the global scope. For me, the new scope created byfor
is worth it :)Btw. the
split
version is even a bit smaller, especially if you add more HTML5 elements.