Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function Arguments(data){
- function recurse(left,right){
- for(var a in right){
- if(right[a] instanceof Object){
- left[a] = {};recurse(left[a],right[a]);
- }
- else left[a] = right[a];
- }
- }
- this.data = data;
- this.attach = function(elem){
- recurse(elem,this.data);
- }
- }
- function A(data){
- return new Arguments(data);
- }
- function node(name,first,data){
- var elem = document.createElement(name);
- var s = 0;
- if(first instanceof Arguments){
- first.attach(elem);
- s = 1;
- }
- for(var a=s; a<data.length; a++){
- elem.appendChild(data[a]);
- }
- return elem;
- }
- function html(first){return node("html",first,arguments);}
- function head(first){return node("head",first,arguments);}
- function body(first){return node("body",first,arguments);}
- function div(first){return node("div",first,arguments);}
- function span(first){return node("span",first,arguments);}
- (function(){
- var a = html(
- head(),
- body(
- span(A({innerText:"U wot m8",style:{fontWeight:"bold"}}))
- )
- );
- document.open();
- document.write(a.outerHTML);
- document.close();
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement