Re: [selectors-api] Matching of :scope in document.querySelector(All)

2012-12-03 Thread Lachlan Hunt
On 2012-11-30 03:01, Boris Zbarsky wrote:
 When implementing :scope support, I discovered that as things stand this
 call:
 
   document.querySelector(:scope)
 
 is specified to return null.  In particular
 http://dev.w3.org/2006/webapi/selectors-api2/#queryselector step 1 calls
 http://dev.w3.org/2006/webapi/selectors-api2/#determine-contextual-reference-nodes
 which returns an empty set.  Then this empty set is passed as an
 explicit contextual reference set to selector matching in
 http://dev.w3.org/2006/webapi/selectors-api2/#evaluate-a-selector so
 that :scope doesn't match anything.
 
 Is this intentional?

I believe the spec was written the way it was to deal with the case
where an explicitly empty set of reference nodes was given for find()
and findAll().  So it seems the current spec ended up treating these in
the same way by matching nothing:

document.querySelector(:scope)
document.findAll(:scope)

document.findAll(:scope, null)
document.findAll(:scope, [])

 I would have expected the above call to return the documentElement,
 which is what :scope would match in a non-scoped stylesheet...

I can change the spec to make the first 2 examples above match
documentElement, but keep the latter two with explicit refNodes
parameters matching nothing.

-- 
Lachlan Hunt
http://lachy.id.au/
http://www.opera.com/




Re: [selectors-api] Matching of :scope in document.querySelector(All)

2012-12-03 Thread Boris Zbarsky

On 12/3/12 7:33 AM, Lachlan Hunt wrote:

So it seems the current spec ended up treating these in
the same way by matching nothing:

document.querySelector(:scope)
document.findAll(:scope)

document.findAll(:scope, null)
document.findAll(:scope, [])


That's how I read it, yes.


I can change the spec to make the first 2 examples above match
documentElement, but keep the latter two with explicit refNodes
parameters matching nothing.


That sounds great to me.  Thanks!

-Boris




Re: [selectors-api] Matching of :scope in document.querySelector(All)

2012-12-02 Thread Dean Edwards
On 30 November 2012 02:01, Boris Zbarsky bzbar...@mit.edu wrote:
 When implementing :scope support, I discovered that as things stand this
 call:

   document.querySelector(:scope)

 is specified to return null.  In particular
 http://dev.w3.org/2006/webapi/selectors-api2/#queryselector step 1 calls
 http://dev.w3.org/2006/webapi/selectors-api2/#determine-contextual-reference-nodes
 which returns an empty set.  Then this empty set is passed as an explicit
 contextual reference set to selector matching in
 http://dev.w3.org/2006/webapi/selectors-api2/#evaluate-a-selector so that
 :scope doesn't match anything.

 Is this intentional?  I would have expected the above call to return the
 documentElement, which is what :scope would match in a non-scoped
 stylesheet...


I would expect it to return documentElement too. Webkit's
implementation does this.

-dean




[selectors-api] Matching of :scope in document.querySelector(All)

2012-11-29 Thread Boris Zbarsky
When implementing :scope support, I discovered that as things stand this 
call:


  document.querySelector(:scope)

is specified to return null.  In particular 
http://dev.w3.org/2006/webapi/selectors-api2/#queryselector step 1 calls 
http://dev.w3.org/2006/webapi/selectors-api2/#determine-contextual-reference-nodes 
which returns an empty set.  Then this empty set is passed as an 
explicit contextual reference set to selector matching in 
http://dev.w3.org/2006/webapi/selectors-api2/#evaluate-a-selector so 
that :scope doesn't match anything.


Is this intentional?  I would have expected the above call to return the 
documentElement, which is what :scope would match in a non-scoped 
stylesheet...


-Boris