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

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Wed, 15 Jul 2015 14:40:55 -0400
Message-ID: <55A6A937.2030503@mit.edu>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
On 7/15/15 2:28 PM, Tab Atkins Jr. wrote:
> There's no explicit definition because I didn't realize there could be
> any possible confusion.

<shrug>.  That's the usual thing that happens when there is no explicit 
definition.

> We already have the + combinator, which relies
> on the exact same concept.

Well, we should fix that.

> How are people interpreting these
> differently, and what needs clarification, exactly?

The spec uses the concept of "siblings" is typically defined as 
"children of the same parent", which is nonsensical when there is no 
parent.  So we should probably explicitly define that when there is no 
parent the set of "siblings" consists of just the element itself, or 
something (and make all mentions of "siblings" link to this definition).

Note that treating "siblings" as the empty set (due to not having a 
parent) would, for example, cause :nth-child(1) to not match, and I 
assume the intent of the spec is that it match an element with no 
parent, yes?  So you really do want "siblings" to be defined as the set 
containing just the element being matched if it has no parent.

-Boris
Received on Wednesday, 15 July 2015 18:41:26 UTC

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