[jQuery] Possible next()/prev() bug?

2007-03-18 Thread EvanT
Hi all, I've come across what is possibly a bug (or unexpected behaviour) when using next(). I have an example page setup here: http://fapdragon.com/test/test.html As far as I can see, the filter for next() is not being applied and it always returns the next DOM element. Can anyone comment on

Re: [jQuery] Possible next()/prev() bug?

2007-03-18 Thread John Resig
.next() and .prev() only work with the next (or previous) /immediate/ element. In your example, the next element is actually a br/ - which your filter doesn't match. Currently there isn't a way to do what you want (easily) in jQuery. I'd imagine it being something like .nextClosest(div.myDiv).

Re: [jQuery] Possible next()/prev() bug?

2007-03-18 Thread EvanT
Thanks John, I thought it might have been the case, the documentation is a little ambiguous. It would be nice to see a function like $(selector).after(filter) that finds the next matching element (I know that after is already used for DOM manipulation) and a similar one for prev() Cheers, Evan