W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Re: Publishing Selectors API Level 2 as an FPWD?

From: Sean Hogan <shogun70@westnet.com.au>
Date: Mon, 11 Jan 2010 22:28:44 +1100
Message-ID: <4B4B0B6C.1070003@westnet.com.au>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: public-webapps <public-webapps@w3.org>
On 11/01/10 8:55 PM, Lachlan Hunt wrote:
>
>>> In the following forms :scope is misleading:
>>>
>>> element.queryScopedSelector(":scope + *")
>>> element.queryScopedSelector(":scope ~ *")
>
> What's misleading about that?  :scope would match the context node 
> (what the element variable points to), and would return its sibling 
> elements.
>


The definition of scope is (something like) " an area in which something 
acts or operates or has power or control". The examples above can return 
nodes that are not within :scope. Therefore :scope is misleading.

>>> and especially:
>>>
>>> element.querySelector("* :scope *", refNode)
>
> Again, how is that misleading?  :scope matches whichever element 
> refNode points to, and then follows the normal rules for evaluating 
> querySelector.  Given that selector, any descendents of refNode that 
> are also descendents of element (the context node) will be matched, 
> the first of which will be returned.
>

In this example, the node represented by :scope isn't the boundary for 
the selection at all.
In one sense, element is the scope because any matched node must be 
descended from element.
In another sense (the sense being used in this discussion), document is 
the scope, because document.documentElement is the upper bounds for 
matching the first "*" in the selector.

In summary, the proposed :scope pseudo-class only acts as a scope for 
the query in special cases, not in the general case.
Received on Monday, 11 January 2010 11:29:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:36 GMT