- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Mon, 03 Dec 2012 13:33:34 +0100
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: public-webapps@w3.org
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/
Received on Monday, 3 December 2012 12:34:02 UTC