Re: [css3-selectors] Structural pseudo-classes and the root element.

(12/06/13 23:22), Simon Sapin wrote:
> Namely, :nth-child, :nth-last-child, :nth-of-type, :nth-last-of-type,
> :first-child, :last-child, :first-of-type, :last-of-type, :only-child
> and :only-of-type are all based on the element having a parent. The root
> element is the only one without a parent, so I guess none of these
> pseudo-classes apply. But I don’t find this very clear in the spec.

  # The :nth-child(an+b) pseudo-class notation represents an element
  # that has an+b-1 siblings before it in the document tree, for any
  # positive integer or zero value of n, *and has a parent element*.

~ http://www.w3.org/TR/selectors/#nth-child-pseudo

I agree this is pretty hard to find.


Cheers,
Kenny

Received on Wednesday, 13 June 2012 15:31:32 UTC