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

On 30 November 2012 02:01, Boris Zbarsky <bzbarsky@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

Received on Sunday, 2 December 2012 10:34:29 UTC