Edit: It's not a duplicate of "Fastest DOM insertion" because it includes the event listeners variable too. Anyway I will edit the question.
I would to know some things if someone already discovered.
I would like to know which is the fastest way to add an element in javascript and to be compatible with ie6+, chrome10+, firefox2+.
Fastest technique to:
Any time curve for adding 1 element or 1000 elements
The same as above but for removing an element
Add/Change/Remove an inline style attribute
Add event listeners like mousedown/mouseup/mouseover
Is faster to add/remove some tags over others? ex: is faster to add/remove a <div> or a <p>? (In the adding mode: I think is faster <p> because it only has 1 letter vs 3 letters, and maybe because div is a container. I don't know, that's why I'm asking :D)
This a big question, so if you only know some of the questions you can always share what you know ;)
thanks thanks!!
1 Set the value of innerHTML on the parent element to a string containing HTML for the new elements.
2 Same as 1.
4 Set the value of innerHTML on the parent element to an empty string.
7.1 Call Node.removeChild(), save the returned Node object, and then pass the node to Node.appendChild().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With