On Apr 24, 3:24 am, "Magnus O." <mag...@magnusottosson.se> wrote:
> I saw that the jQuery.each function iterates over the array like this:
> for ( name in object){}

Only for objects which lack the 'length' property.

That's why the code exists below this comment:
  // A special, fast, case for the most common use of each

The speed improvement you are seeing is probably because you are
avoiding a jQuery constructor, a function call, and many function
callbacks. Internally, it is iterating over your array using an index.

See this thread, where I make some suggestions for improving .each()
  
http://groups.google.com/group/jquery-dev/browse_frm/thread/be468dd3344f5f26/d340a8799e416615

Matt Kruse

Reply via email to