W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2008

Re: Call for Consensus - Selectors Last Call

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sat, 01 Nov 2008 00:52:49 +0100
Message-ID: <490B9A51.7080703@lachy.id.au>
To: Kartikaya Gupta <lists.webapps@stakface.com>
CC: public-webapps@w3.org

Kartikaya Gupta wrote:
> On Fri, 31 Oct 2008 16:06:23 +0100, "Charles McCathieNevile"
> <chaals@opera.com> wrote:
>> [1] http://dev.w3.org/2006/webapi/selectors-api/ [2] 
> Is it just me or is the "scope element" somewhat under-defined in the
> spec? The only mentions of it are in this sentence:
> "If the context node is a Document node, then the scope element is 
> the documentElement of the given document. If the context node is an
> Element node, then the scope element is the same as the context 
> node."
> However, it doesn't say what the scope element does or why it's 
> relevant, nor does it have a reference to any other spec that 
> explains this. I did a quick search through the list archives (I 
> haven't been following it too closely) and it looks like the :scope 
> pseudo-class will be defined in another spec.

It was added with the intention of referencing whichever spec :scope (or 
whatever it gets called) gets defined in, which will most likely be 
Selectors Level 4.  The statement itself makes sense when read in the 
context of the :scope proposal.


But I suppose I could comment it out for now, until :scope is defined in 
a real spec and the statement is actually needed.

> Also, since the scope element stuff was deferred to another spec,
> this spec remains somewhat ambiguous (at least to me) about exactly
> what gets selected in the following case:
> <html>
>  <body>
>   <div class="bar">
>    <div id="foo">
>     <div class="baz"></div>
>    </div>
>   </div>
>  </body>
> </html>
> document.getElementById('foo').querySelector('.bar .baz')

This is covered in the spec by the statement:

   "Selectors are evaluated against a given element in the context the
    entire DOM tree in which the element is located."

> I believe the above querySelector call should return the "baz" div as 
> opposed to NULL, but it took me a few close readings of the spec to 
> decide on that. A clarifying example in the spec would be quite 
> helpful on this one.

Yeah, I suppose it's not too late to add a small example illustrating that.

I've made those changes in the current editor's draft.  Though I'd 
rather not make too many additional changes now as I don't want to hold 
up publication.  Any other issues like this can wait till after this 
Last Call draft is published and can be fixed before it goes to CR.

Lachlan Hunt - Opera Software
Received on Friday, 31 October 2008 23:53:36 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:12 UTC