[jQuery] Re: Performance Booster - $( expr, context, fn ) ?

2007-08-13 Thread Joel Birch
On 8/13/07, willi [EMAIL PROTECTED] wrote: Hallo, When the search $() returns a lot of objects (1), then you have to loop twice through this objects. First for selecting the elements, and then second when doing somthing with the elements. e.g. $('td').addClass('red'); // get all

[jQuery] Re: Performance Booster - $( expr, context, fn ) ?

2007-08-13 Thread Sean Catchpole
You bring up an interesting point Willi. You stated that $() runs 2 times, which is correct, except that the first time there is significantly more work being done. The first time it has to search through the DOM collecting all the DOM elements and matching them against the selector. This is a lot