Oops, I meant
$(this).parents().andSelf().nextAll('b:first');
Slightly different :) And yeah, that gets quite slow on a large DOM,
in the 100ms range for thousands of elements.
cheers,
- ricardo
On Jan 14, 8:09 pm, Leeoniya wrote:
> i dont believe it will, next and nextAll only work on siblin
i dont believe it will, next and nextAll only work on siblings. in my
example, they arent.
On Jan 14, 3:27 pm, Ricardo Tomasi wrote:
> On Jan 14, 2:11 pm, Leeoniya wrote:
>
> > nextest() that works outside the bounds of the parent container? for
> > example:
>
> >
> > bar
> >
> >
> > Hel
On Jan 14, 2:11 pm, Leeoniya wrote:
> nextest() that works outside the bounds of the parent container? for
> example:
>
>
> bar
>
>
> Hello!
>
>
> $("#foo").nextest("b") would return the second node in the tree
> following the current element, but not a sibling. right now i'm
> needing
slight addition/correction to above:
$(this).ancests(":eq(0)"); // parent
$(this).ancests("li:eq(0)");// filtered parent
also if .and() is used to retain self, as i put above, ancest() isnt
necessarily accurate wording since if it can select itself then it
really isnt its own anc
ah, i didnt know parents() worked that way, i thought it was just a
(.parentNode & .is()) loop rather than a full DOM parentNode loop
followed by a filtering the resultset.
I should say i feel .parents() should have probably been ancests(), i
always found the parent/parents method pair kinda misl
The major reason is that while the functionality is equivalent -
closest is significantly faster (since it's able to process each
element one element at a time rather than finding all elements then
filtering).
This was discussed in the Delegation Filtering Performance part of the release:
http://
John,
closest() which i feel should have been first-ancest-or-self() is
nearly functionally identical to parents("li:eq(0)").andSelf
()except andSelf would need to prepend to the collection rather
than append, since position matters.
was there a reason for creating a near-identical method? se
well, if the function will require a predefined scope, then it's kind
of pointless to create a new method for something that can easily be
done by pre-speccing the context in a single selector ahead of time
eg: .parents(":eq(3)"), you would still need to use index(), but
essentially all you'd be d
> 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