W3C home > Mailing lists > Public > www-style@w3.org > September 2017

Re: [selectors] Child-indexed pseudo-classes and the root element

From: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Wed, 6 Sep 2017 09:48:18 +0200
To: www-style@w3.org
Message-ID: <255e8f63-f616-2b3d-6f1e-4bfb558b23a9@crisal.io>
There was quite a bit of discussion already, see:


Note that the L3 definition was in terms of parent _elements_, and that
didn't play very well with shadow DOM. See also the blink-dev discussion:


On 09/06/2017 06:51 AM, Daniel Tan wrote:
> I noticed that :root:nth-child(n) now matches in Chrome and Firefox. It
> does not match in Safari, IE or Edge, as I would expect. It seems that
> this was changed in selectors-4, which says
>> Note: Selectors 3 described these selectors as selecting elements
>> based on their index in the child list of their parents. (This
>> description survives in the name of this very section, and the names
>> of several of the pseudo-classes.) As there was no reason to exclude
>> them from matching elements without parents, or with non-element
>> parents, they have been rephrased to refer to an element’s relative
>> index amongst its siblings.
> The definition of "inclusive siblings" points to the DOM spec, which
> requires that an element have a non-null parent in order to be
> considered a sibling:
>> An inclusive sibling is an object or one of its siblings.

Well, this definition seems like it would match "an object" itself,
regardless of the parent node required to be a "sibling", so I don't
think there's any inconsistency here.

Regardless of that, the root element's parent node is non-null anyway
(the parent node is the document node). This boils down again to parent
element vs. parent node.

 -- Emilio
Received on Wednesday, 6 September 2017 09:14:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:08 UTC