Skip to content

Instantly share code, notes, and snippets.

@NHQ
Created November 29, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NHQ/4172468 to your computer and use it in GitHub Desktop.
Save NHQ/4172468 to your computer and use it in GitHub Desktop.
EZ DOM node deep clone
module.exports = deepClone
function deepClone(el){
var node = el.cloneNode();
Array.prototype.slice.call(el.childNodes).forEach(function(child){
node.appendChild(deepClone(child))
});
return node
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment