Is cloning nodes quicker than generating new elements?Skip to comment form
Writing 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.
Post a Reply
Comments are closed.