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: Mon, 18 Mar 2013 12:26:07 -0700
Message-ID: <CAAWBYDDMoVprBMXLXXWO2JVQH8OGd0SjeJ0H82FqD24FXJj=nA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style list <www-style@w3.org>
On Mon, Mar 18, 2013 at 11:48 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> The selectors spec says, at
> http://dev.w3.org/csswg/selectors4/#the-first-child-pseudo :
>   The :first-child pseudo-class represents an element that is the first
>   child of some other element.
> and similar for other structural pseudo-classes.
> On the face of it that means such selectors never match root elements or
> children of document fragments.
> Is this restriction purposeful?  It seems like sane structural pseudo-class
> matching (e.g. nth-of-type) might be desirable with querySelector on
> DocumentFragment at the very least...

fantasai says this was indeed purposeful, and letting them match the
root doesn't really buy you anything in a normal document, but your
documentFragment usecase is compelling.

I think we should change to at least allow it in that case.  I suspect
it's compat-friendly to allow it to match a normal root as well.

Received on Monday, 18 March 2013 19:26:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:27 UTC