Bug Tracker

Modify

Ticket #360 (closed bug: wontfix)

Opened 7 years ago

Last modified 7 years ago

$('dd:nth-child(odd)') Doesn't select correctly

Reported by: gavinmroy@… Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: nth-child() dd dt Cc:
Blocking: Blocked by:

Description

I'm trying to use nth-child on elements of a dl but it's not selecting the correctly.

Output from firebug:

>>> $('#TEngineInformation dd');
[<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>]

>>> $('#TEngineInformation dd:nth-child(odd)');
[<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>,<dd>]

>>> $('#TEngineInformation dd:nth-child(even)');
[]

>>> $('#TEngineInformation dt');
[<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>]

>>> $('#TEngineInformation dt:nth-child(odd)');
[]

>>> $('#TEngineInformation dt:nth-child(even)');
[<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>,<dt>]

From that example it looks as if it's only looking at children of the dl itself for even and odd not the dd or dt.

Change History

comment:1 Changed 7 years ago by joern

  • Version 1.0 deleted
  • Component changed from ajax to core
  • Milestone 1.0 deleted

comment:2 Changed 7 years ago by john

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

This is correct - and the way its expected to work in CSS. To do what you want, you would use :nth-of-type(odd). But I removed that particular selector a while back, since no one seemed interested in using it.

For now, you can simulate your particular result by doing:

  $('#TEngineInformation dd:odd')

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

View

Add a comment

Modify Ticket

Action
as closed
Author


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

 
Note: See TracTickets for help on using tickets.