Bug Tracker

Opened 14 years ago

Closed 12 years ago

#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:
Blocked by: Blocking:

Description

  1. The selector '$(".className:not(:first)").length)' returns one too many elements in IE.
  1. 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 (1)

ie_selector_bug.html (975 bytes) - added by bryfox 14 years ago.
Test case

Download all attachments as: .zip

Change History (9)

Changed 14 years ago by bryfox

Attachment: ie_selector_bug.html added

Test case

comment:1 Changed 14 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:2 Changed 13 years ago by arangas

Confirmed in IE8 RTM (8.0.6001.18702).

comment:3 Changed 12 years ago by dmethvin

Status: newopen

comment:4 Changed 12 years ago by anonymous

+1 had this issue too.

comment:5 Changed 12 years ago by laubstein

This problem is still present: jQuery 1.5.1

Testcase: http://jsfiddle.net/laubstein/rU4h4/

comment:6 Changed 12 years ago by danheberden

Milestone: 1.3.21.next

comment:7 Changed 12 years ago by john

#4468 is a duplicate of this ticket.

comment:8 Changed 12 years ago by john

Resolution: wontfix
Status: openclosed

This isn't something that we're going to fix: http://docs.jquery.com/Won%27t_Fix

You should use .slice(1) instead.

Note: See TracTickets for help on using tickets.