W3C home > Mailing lists > Public > www-style@w3.org > July 2015

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

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Wed, 15 Jul 2015 20:57:16 +0200
To: www-style@w3.org
Message-ID: <55A6AD0C.8080204@disruptive-innovations.com>
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?

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:18 UTC