Re: [selectors] Need to clearly define matching for :first-child, :nth-*, etc

On 15/07/2015 20:12, Boris Zbarsky wrote:

> There is some confusion about how things should work when an element has
> no parent and hence no concept of siblings.
> 
> The language in the spec is vague enough that different people are
> interpreting it different ways.  It would be good to clarify things here
> by explicitly defining the sibling list of an element for purposes of
> this stuff or something; right now there is no definition that I can find.

I think we had that discussion when I originally added :nth-child() to
a draft of Selectors 3 eons ago. The consensus was that the functional
pseudo-class does not match if there is no parent IIRC. We considered
another definition of nth sibling counting the nth nextSibling element
from the earliest predecessor element but ditched it.

I would recommend not changing the current spec, based on the
existence of a parent, and stick to the original perception: no parent
implies no match. But Boris has a point, the Selectors specs (all
levels) miss a definition of the word "sibling". We don't even reference
another spec for that. Let's add one?

</Daniel>

Received on Wednesday, 15 July 2015 18:57:40 UTC