On Jul 18, 2008, at 9:13 AM, Mike Alsup wrote:


Yes, Sam's selector will definitely stop climbing the DOM once it
finds the first match. That's what the :eq(0) part does.

Actually, I don't think that's true.  I believe :first, :last, :eq,
etc apply their logic after the list of potential elements has been
built.  The results are accurate of course, but I don't see where
their is any optimizations for the :first or :eq cases to short-
circuit the climb.

Mike

Ah, I see what you mean. I misunderstood what was actually meant by "stop climbing the DOM" and assumed he meant stop returning elements.

Anyway, you're right. It won't return any of the other elements, but it *will* climb all the way up before it returns just the first match. Thanks for the clarification, Mike!



--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to