Bug Tracker

Opened 8 years ago

Closed 5 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>

Change History (8)

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

Confirmed in IE8 RTM (8.0.6001.18702).

comment:3 Changed 6 years ago by dmethvin

  • Status changed from new to open

comment:4 Changed 6 years ago by anonymous

+1 had this issue too.

comment:5 Changed 6 years ago by laubstein

This problem is still present: jQuery 1.5.1

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

comment:6 Changed 6 years ago by danheberden

  • Milestone changed from 1.3.2 to 1.next

comment:7 Changed 5 years ago by john

#4468 is a duplicate of this ticket.

comment:8 Changed 5 years ago by john

  • Resolution set to wontfix
  • Status changed from open to closed

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.