> i've been using chains like this all over my webapp:
>
> $(this).parents("li:eq(0)")
>
> it seems that closest is a direct replacement for this and a
> functional equiv of
>
> $(this).closest("li").

It's almost equivalent to that. There's the possibility that if 'this'
is an li element that it will be returned. closest always starts with
the current element then works its way up.

> also, is there anything like
>
> nextest() that works outside the bounds of the parent container? for
> example:
>
> <span>
>  <b id="foo">bar</b>
> </span>
> <span>
>  <b>Hello!</b>
> </span>
>
> $("#foo").nextest("b") would return the second <b> node in the tree
> following the current element, but not a sibling. right now i'm
> needing to create funky ways to do this, unless i'm missing something.
>
> right now i'm forced to do:
>
> var $e = $("#foo");
> var i = $("b").index($e);
> var finally = $("b:eq(" + (i+1) + ")");
>
> ..also consider than in real life $e is not retrieved by id but is
> "this" inside a function and often inside of a .each loop.

Maybe. I'm wary of a function like this since it would have to be very
"smart" about where to look - and that can get expensive.

A better method might be something like: .nextCousin(), .prevCousin(),
.nextUncle(), .prevUncle() :)

--John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to