Bug Tracker


Ticket #3924 (closed bug: fixed)

Opened 5 years ago

Last modified 2 years ago

(nth/first/last)-child selector bug

Reported by: LosT Owned by:
Priority: major Milestone: 1.3.1
Component: selector Version: 1.3
Keywords: Cc:
Blocking: Blocked by:


Manipulating the dom after *-child selector may break sequent *-child selectors if the number of childs remains the same.


I think this is caused by caching in filter.CHILD, here: var doneName = "child" + parent.childNodes.length;

Changing it to var doneName = match[0];

(which i saw is set in preFilter.CHILD) should fix the problem.

Also, parent.childNodes.length is painfully slow on explorer. This change should speed up IE (and slow down the other browsers).


test2.html Download (479 bytes) - added by LosT 5 years ago.
Test case

Change History

Changed 5 years ago by LosT

Test case

comment:1 Changed 5 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed
  • Component changed from unfilled to selector

Thanks for the test case, I just fixed this in SVN rev [6147].

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.