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

On Wed, Jul 15, 2015 at 11:40 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> 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.

I just pinged Anne to define "sibling list" in DOM, to be the object
and all of its siblings in tree order.  Then I'll switch Selectors to
using that term and linkify it.

(But seriously, what are people misinterpreting this as? Do they think
:first-child shouldn't match an element without a parent? Switching
away from the "parent/child" language was *explicitly* meant to avoid
that sort of misinterpretation!)

~TJ

Received on Wednesday, 15 July 2015 18:48:33 UTC