Modify ↓
Ticket #4028 (closed bug: wontfix)
".className:not(:first)." incorrect in IE
| Reported by: | bryfox | Owned by: | john |
|---|---|---|---|
| Priority: | major | Milestone: | 1.next |
| Component: | selector | Version: | 1.3.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
- The selector '$(".className:not(:first)").length)' returns one too many elements in IE.
- The selector '$("div.className:not(:first)").length)' returns one too many elements in IE if the className divs are inside a containing div.
Tested in IE6 and IE7 under windows XP, jQuery 1.3.1. (No problem with 1.2.6.)
Example markup:
<div>
<div class="className"></div>
<div class="className"></div>
</div>
<script>
$("div.className:not(:first)").length); // == 2 in IE
$(".className:not(:first)").length); // == 2 in IE
</script>
Attachments
Change History
Changed 4 years ago by bryfox
-
attachment
ie_selector_bug.html
added
comment:1 Changed 4 years ago by dmethvin
Confirmed; it behaves the same way in IE8RC1, with a name other than className, and using .ready() instead of document.write.
comment:5 Changed 2 years ago by laubstein
This problem is still present: jQuery 1.5.1
Testcase: http://jsfiddle.net/laubstein/rU4h4/
comment:8 Changed 23 months ago by john
- Status changed from open to closed
- Resolution set to wontfix
This isn't something that we're going to fix: http://docs.jquery.com/Won%27t_Fix
You should use .slice(1) instead.
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.

Test case