Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#360 closed bug (wontfix)

$('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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 10 years ago by joern

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

comment:2 Changed 10 years ago by john

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

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')
Note: See TracTickets for help on using tickets.