Deep cloning vs setting of innerHTML: what's faster?
问题 I'm trying to figure out the most performant way of deep-cloning a DOM tree within the browser. If I start out with var div = document.getElementById("source"); var markup = div.innerHTML; What will be faster, var target = div.cloneNode(true); or var target = document.cloneNode(false); target.innerHTML = markup; I understand the browser platform may make a big difference here, so any information about how these compare in the real world would be appreciated. 回答1: Let's test! I added the