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

On Tue, Mar 19, 2013 at 1:30 PM, Daniel Glazman
<> 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