Re: Publishing Selectors API Level 2 as an FPWD?

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 UTC