Skip to content

Instantly share code, notes, and snippets.

@shim0mura
Created December 11, 2011 22:04
Show Gist options
  • Save shim0mura/1463032 to your computer and use it in GitHub Desktop.
Save shim0mura/1463032 to your computer and use it in GitHub Desktop.
function append(arg){
if(typeof arg === "string"){
this.innerHTML = arg;
}else{
var df = document.createDocumentFragment();
for(var i=0, l=arguments.length; i<l; i++){
if(arguments[i].nodeType == 1){
alert(111);
df.appendChild(arguments[i]);
}
}
console.dir(df);
this.appendChild(df);
}
}
//var wrapper = document.getElementById("test");
//var elm = document.createElement("div");
//elm.innerHTML = "test div";
//append.call(wrapper, elm2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment