Bug Tracker

Ticket #4028 (closed bug: wontfix)

Opened 6 years ago

Last modified 3 years ago

".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

  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

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

Change History

Changed 6 years ago by bryfox

Test case

comment:1 Changed 6 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 5 years ago by arangas

Confirmed in IE8 RTM (8.0.6001.18702).

comment:3 Changed 4 years ago by dmethvin

  • Status changed from new to open

comment:4 Changed 3 years ago by anonymous

+1 had this issue too.

comment:5 Changed 3 years ago by laubstein

This problem is still present: jQuery 1.5.1

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

comment:6 Changed 3 years ago by danheberden

  • Milestone changed from 1.3.2 to 1.next

comment:7 Changed 3 years ago by john

#4468 is a duplicate of this ticket.

comment:8 Changed 3 years 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.

Note: See TracTickets for help on using tickets.