Skip to content

24 ways to impress your friends

Vote up?

JulienW

@Andi: I’m quite surprised too. Especially on Chrome.

It means that adding once as innerHTML is always faster than creating individual nodes.

But I’m really not satisfied by this as it makes the code exposed to bad characters in strings (read: code injection).

I’d like to see what happens with DOM document fragments…

Anyway, I dislike to micro-optimize because the measured performance can change in the next browser version… I do prefer to code secure and reasonably fast, than the contrary. If jQuery is your bottleneck, you’re doing something wrong (like putting your model in the DOM).