Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14631 closed bug (invalid)

nth-last-child selector behaves differently in webkit (chrome)

Reported by: [email protected] Owned by: [email protected]
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


I was originally using the below code to get the last 16 elements and put them in front of the other nodes (paging)

query("#links a:nth-last-child(-n+16)").prependTo(query("#links")).show(0);

Which works on IE and FF but does not behave correctly in Chrome

I lazily modified the above to

query("#links a").slice(query("#links a").length - 16).prependTo(query("#links")).show(0);

Which works fine. I suspect this is a bug with webkit, based of all the nth-child bugs previously filed. This is just a reminder to possibly fix the nth-last-child as well.

Change History (3)

comment:1 Changed 9 years ago by timmywil

Owner: set to [email protected]
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the "jQuery(edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read:

Additional resources:

comment:2 Changed 9 years ago by anonymous

It seems that the case I have might not related to the nth-last-child selector but to something else.

Here everything is working... http://jsfiddle.net/FrKyN/

Yet I had to change the previous to the below to get it to work in chrome (note jquery is embedded as query)...

query("#links a").slice(query("#links a").length - 16).prependTo(query("#links")).show(0);

comment:3 Changed 9 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.