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

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.

> An object A is called a sibling of an object B, if and only if B and 
> A share the same non-null parent.

I personally disagree with the change from L3 as it only serves to
confuse, but in any case, if L4 does mean to update the child-indexed
pseudos to match elements without parents, it should probably not use
the definitions from the DOM spec, but its own.
-- 
Daniel Tan
<http://NOVALISTIC.com>

Received on Wednesday, 6 September 2017 04:52:07 UTC