Created
July 30, 2012 16:14
-
-
Save middric/3208137 to your computer and use it in GitHub Desktop.
domBuilder
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
var domBuilder = function(h, i, j, k, l) { | |
while(l=i.shift()) { | |
if ((j = l[0]) && j.exec) { | |
k = document.createElement((j+"").split('/')[1]); | |
for(j in l[1]) { | |
k[j] = l[1][j] | |
} | |
h.appendChild(k); | |
h = k; | |
} else { | |
l[0] ? h.innerHTML = l : h = h.parentNode | |
} | |
} | |
}; |
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
var a=function(c,e,a,d,b){for(;b=e.shift();)if((a=b[0])&&a.exec){d=document.createElement((a+"").split("/")[1]);for(a in b[1])d[a]=b[1][a];c.appendChild(d);c=d}else b[0]?c.innerHTML=b:c=c.parentNode} |
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
domBuilder(document.body, [ | |
[/HTML/], | |
[/HEAD/], | |
[/TITLE/], | |
"Wouldn't this be cool?", | |
[], | |
[], | |
[/BODY/], | |
[/DIV/, {id: "container"}], | |
"Hello, world", | |
[], | |
[], | |
[] | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment