Modify ↓
Ticket #7063 (closed bug: invalid)
Bug with :not and :last
| Reported by: | hobbestigrou | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4.3 | |
| Component: | selector | Version: | 1.4.2 |
| Keywords: | selector, :last, :not, :first | Cc: | |
| Blocking: | Blocked by: |
Description
Hi,
I'm using the latest version of jQuery 1.4.2.
I have a problem with :not and :last I think. For exemple when I try with this syntax: $('.reverse:visible:last:not(:first)');
and this match anything, but if I use this syntax: $('.reverse:visible:not(:first):last');
This matches one element, so this is ok.
I've tried with chromium 6.0.4 and Firefox 3 and 4.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is not a bug.
The first selector finds the last .reverse, then removes it if it is the first of the filtered elements. Since it is always the first, it will always be filtered away.
The second selector finds all .reverse that are not the first, and then picks the last one of those.