2 ms·
x.innerHTML is a DOM operation too. I would think you want to differentiate between doing an "innerHTML" operation and "other DOM operations" That said, constr
by smwhreyebelong 17y ago
x.innerHTML is a DOM operation too. I would think you want to differentiate between doing an "innerHTML" operation and "other DOM operations"
That said, constructing HTML as a string and using one innerHTML call is much faster than doing createNode/appendChild multiple times. DOM operations are definitely the bottleneck when it comes to performance : The less of them you do, the better off you are. (I learnt my lesson the hard way)
- briansmith 17y agoTry DocumentFragment instead: http://ejohn.org/blog/dom-documentfragments/ http://ejohn.org/blog/dom-documentfragments/ http://slayeroffice.com/articles/innerHTML_alternatives/#5c http://slayeroffice.com/articles/innerHTML_alternatives/#5c