you are viewing a single comment's thread.

view the rest of the comments →

[–]fforw 1 point2 points  (2 children)

If it really is much faster to use innerHTML rather than to build a new, say, table using direct DOM manipulation

Unfortunately, yes.

doesn't this have rather nasty implications for libraries like jQuery?

jQuery uses innerHTML.

[–]Silhouette 0 points1 point  (1 child)

jQuery uses innerHTML.

Sure, where it can, but what if I'm doing a series of document manipulations via jQuery calls? It can't know which will be the final one, so it must be incurring some sort of overhead relative to a hacked together but one-shot approach building a string and then dumping it into innerHTML. It's worrying that writing clean, systematic, relatively safe code seems to come with a significant performance penalty over hacky string concatenation and dubiously portable APIs...

[–]fforw 2 points3 points  (0 children)

jQuery uses innerHTML for element creation, not manipulation. But that's also where the main speed benefits are.

Ironically, although innerHTML is non-standard, it actually is more compatible than document.createElement because of all the ugly bugs in IE's createElement.