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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 29 Nov 2012 21:01:32 -0500
Message-ID: <50B8137C.4090900@mit.edu>
To: public-webapps@w3.org
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
Received on Friday, 30 November 2012 02:02:04 GMT

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