Kartikaya Gupta wrote:
On Fri, 31 Oct 2008 16:06:23 +0100, "Charles McCathieNevile"
<[EMAIL PROTECTED]> 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.

http://lists.w3.org/Archives/Public/www-archive/2008Jul/att-0025/Overview.html

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
http://lachy.id.au/
http://www.opera.com/

Reply via email to