W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [selectors] Matching of :first-child and the like for elements whose parent is not an element

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 19 Mar 2013 14:06:17 -0700
Message-ID: <CAAWBYDAyJQa-HCuKzEpqujTUznMjcFwqjC6rfMEAZwJtJ9UKMw@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-style list <www-style@w3.org>
On Tue, Mar 19, 2013 at 1:30 PM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Boris, do you want to take an action item to summarize the various
> possibilities (on both Selectors and Selectors API sides if needed)
> here so the WG can make a decision?

I can do that, as it's pretty easy:

1. No change.  Leave the world as it is, where :first-child and
friends only works on elements that are "children", that is, elements
that have parents which are also elements.  In particular, they won't
match root nodes, nor any "top-level" nodes in a DocumentFragment.

2. Relax the restriction on DocumentFragments, so that :first-child
and friends can apply to the top-level elements there.  Keep the
root-node restriction.  This probably requires only a change in
Selectors API, to define that DocumentFragments are treated as the
"parent" of the top-level elements inside for the purposes of

3. Relax the restrictions entirely, so that :first-child will match a
root node, or the top-level children of a DocumentFragment.  This is
most naturally a change in Selectors 4, where we'll change the meaning
of :first-child and friends to be defined in terms of siblings, or
just make an explicit exception for parent-less nodes as still being
"children" for the purposes of our definition.

Received on Tuesday, 19 March 2013 21:07:09 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:25 UTC