[jQuery] Re: Trouble with $#next() and ':not()' selector

2008-11-19 Thread Hector Virgen
Very nice, thanks! For some reason I assumed that next() would return the next element that matches the selector, not just the next element *if* it matches the selector. I like your implementation of nextOf. It seems like it would be faster than my nextAll alternative. -Hector On Tue, Nov 18, 2

[jQuery] Re: Trouble with $#next() and ':not()' selector

2008-11-18 Thread ricardobeat
Here's a quick function that walks forward one element at a time until one matches the selector: $.fn.nextOf = function(sel){ var next = this,n; do { next = next.next(); n = next.filter(sel); if (n.length) return n; } while(next.length); return this.filter(

[jQuery] Re: Trouble with $#next() and ':not()' selector

2008-11-18 Thread Richard D. Worth
On Tue, Nov 18, 2008 at 7:57 PM, Hector Virgen <[EMAIL PROTECTED]> wrote: > > It seems to me that $#next() gets the very next element, then tries to > match it to the selector. Is this the intended behavior? > Yes, it gets the very next element and then applies the selector as a filter. For the o

[jQuery] Re: Trouble with $#next() and ':not()' selector

2008-11-18 Thread Richard D. Worth
On Tue, Nov 18, 2008 at 7:57 PM, Hector Virgen <[EMAIL PROTECTED]> wrote: > > It seems to me that $#next() gets the very next element, then tries to > match it to the selector. Is this the intended behavior? > Yes, it gets the very next element and then applies the selector as a filter. For the o

[jQuery] Re: Trouble with $#next() and ':not()' selector

2008-11-18 Thread Hector Virgen
Correction: that last console.log does report "Third" as expected. -Hector On Tue, Nov 18, 2008 at 4:57 PM, Hector Virgen <[EMAIL PROTECTED]> wrote: > I have a simple list of items, and I am dynamically disabling them by > adding a class name of "disabled" to the . When I try to select the next