On Monday 2013-04-08 09:56 -0400, Justin Lebar wrote: > > My plan would be: inject everything but external inputs using innerHTML > > or insertAdjacentHTML > > Isn't this a premature optimization? > > I should think that we should do the unquestionably-safe thing 99% of > the time, and then use innerHTML only as a last resort when HTML > parsing is a bottleneck.
I was under the impression (though I could be wrong; it's a vague memory from a while ago) that more of the performance difference between the two was related to the time (and memory) overhead of having to construct (and then later destroy) JS wrappers for all the nodes in the DOM case (but not the innerHTML-setting case) rather than the parsing. -David -- 𝄞 L. David Baron http://dbaron.org/ 𝄂 𝄢 Mozilla http://www.mozilla.org/ 𝄂 _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
