Andrea Ercolino schrieb:
> mea culpa
> I made a 'mistake': I put in the loop an accessor $( ".class" ) that caused
> the abnormal delay. 
> After saving the reference $class = $( ".class" ) before entering the loop,
> the delay has lowered to 78 milliseconds in IE7 AND 78 milliseconds in
> FF1.5.0.8: unbelievable!

If you know the type of your element, you can make the query a little 
faster:

$('div.class')

And if you know the context, even more: $('div.class', aDOMNode)

Also, as an alternative to Mike's excellent solution (once again), if 
you have to create similiar structures a lot of times you can create one 
template and use clone() later on, its slightly faster then 
createElement (but still not as fast as Array.join() plus innerHTML)...

Here are some interesting benchmarks with all the different techniques:
http://www.quirksmode.org/dom/innerhtml.html


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to