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

Re: Call for Consensus - Selectors Last Call

From: Stewart Brodie <stewart.brodie@antplc.com>
Date: Fri, 31 Oct 2008 17:47:27 +0000
To: <public-webapps@w3.org>
Message-ID: <cfcc17c7e2f35dc280e423deac2d570203f66141@localhost>

Kartikaya Gupta <lists.webapps@stakface.com> wrote:

> 
> On Fri, 31 Oct 2008 16:06:23 +0100, "Charles McCathieNevile"
<chaals@opera.com> wrote:
> >
> > So this is a call for Consensus to publish the Editor's Draft [1] of the
> > Selectors API spec as a Last Call. Please respond before Monday November
> > 10. As always, silence is taken as assent but an explicit response is
> > preferred.
> >
> > Opera supports publication of this draft as a Last Call.
> >
> > [1] http://dev.w3.org/2006/webapi/selectors-api/
> > [2]
> > http://dev.w3.org/2006/webapi/selectors-api/disposition-of-comments.html
> >
> 
> 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. I think that should be clarified, because otherwise it just
> looks like a completely random sentence that would be better taken out
> altogether.

I concur.

I've just read the spec through the start to finish for the first time in
many months, prompted by these announcements, and came up with a number of
questions.  Then I've read through all the articles in the disposition of
comments, and found that the same issues have already been raised and
discussed at length, but it seems that in some cases, no changes or
clarifications have been made to the document in response.  Perhaps the
meaning of the spec is obvious to those who have been actively working on
the document who know what assumptions to make, but they aren't clear to me.

I really think that the spec needs to nail down the answers to these
questions - just a simple sentence (or non-normative example) will do.


The specific questions I had (which I think I found the definitive answers
for in the mail archives):


1) What is the scope element for - it's only mentioned in one sentence?

2) Is an empty string actually a valid selector?  If not, then the whole
"null/undefined is an empty string" discussion is irrelevant - it's simply a
syntax error.

3) Does the matching algorithm work on based on the entire tree that
contains the context node or just the sub-tree rooted at the context node? I
think this is easiest fixed by adding an example like the one in the
previous e-mail that I'm quoting and stating the expected result:


> 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')
> 
> 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.

After trawling through the comments, I also think that the answer is that it
works on the entire tree, and consequently the baz div should be the one and
only result.


-- 
Stewart Brodie
Software Engineer
ANT Software Limited
Received on Friday, 31 October 2008 17:48:07 GMT

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