W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: Supporting Scoped Selectors in Selectors API 2

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 28 Sep 2009 19:46:59 -0500
Message-ID: <dd0fbad0909281746x59ba2c38m7910b02e2af88c24@mail.gmail.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Cc: www-style <www-style@w3.org>
On Mon, Sep 28, 2009 at 6:49 PM, Lachlan Hunt <lachlan.hunt@lachy.id.au> wrote:
> It might appear to work for the simple case above, but consider the
> following cases:
> elm.querySelectorAll(":reference+p, div div");
> Or the reverse of that:
> elm.querySelectorAll("div div, :reference+p");

I'm not sure what the problem here is.  Surely you have to parse the
entire string before starting *anyway*.  What's wrong with saying
that, if :reference is found anywhere in the selector, it's a scoped
selector string?

> As defined, for non-scoped selectors, the implementation only needs to test
> descendants of elm.  For scoped selectors, it needs to check the whole tree
> (or at least the element's descendants, siblings and their descendants).

It only needs to do so if it detects something starting with +, ~,
:reference+, or :reference~.  Otherwise it can just look at
descendants, same as normal querySelector.

Received on Tuesday, 29 September 2009 00:47:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:39 UTC