Shorter DOMScripting via Cloning vs. Generating New Elements?
By Christian Heilmann | January 6th, 2006 | Filed in DOM, DOM Scripting TF
Is cloning nodes quicker than generating new elements?
Skip to comment formWriting some scripts I realised lately that a lot of times we repeat code over and over again, especially when we generate HTML – like list items with embedded links. I wondered if it wouldn’t make sense that instead of creating those where we need them in the script it’ll be more slick to create them once and clone them via cloneNode() later on.
Please check the relevant post about cloning vs. generating elements and give the test code a spin to see if you can find any bad issues I have overseen.