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

On Tue, Mar 19, 2013 at 1:07 PM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Well. querySelector() just did not exist at all at the time we
> designed :first-child and the first versions of the Selector API spec
> were allowing querySelector() only on the document, not on fragments or
> even any element... I guess at the time it changed to allow it on
> document fragments, we were almost in PR and not in a position to change
> the spec.
> So we need to deal with Boris's request as an errata, and do a s/some
> other element/some other node/ in the prose he quoted.

No real need for errata.  We can just change the definition in
Selectors 4, and SelectorsAPI2 can specify the behavior on
DocumentFragments.

> About not selecting the root of the document, I don't see that
> as a bug since the name of the pseudo is first-*child* after all.

I don't see a meaningful distinction between a root node and a node
without a parent in a DocumentFragment.

Plus, the :*-child pseudos are just unrestricted variants of the other
pseudos like :first-of-type, so trying to draw too much meaning from
the name doesn't seem useful.  We could have called it
:first-among-siblings, but that's a bad name for other reasons.

~TJ

Received on Tuesday, 19 March 2013 20:28:42 UTC