Re: [selectors-api] Scoped Selectors

Sean Hogan wrote:
> Hi Lachy,
>
> Here's a proposal.
>
> querySelector*(selector, context) // allows selectors with :scope 
> pseudo-class
> queryScopedSelector*(selector, context) // allows selectors with 
> implied :scope
> matchesSelector(selector, context) // allows selectors with :scope 
> pseudo-class
>
> To check if the :scope pseudo-class is available, use:
>
> try { document.body.matchesSelector(":scope", document.body); }
> catch (error) { /* not supported */ }
>
>  OR
>
> try { document.querySelector(":scope", document.body); }
> catch (error) { /* not supported */ }
>
Sorry. Replace document.body with document.documentElement. That should 
be more efficient for the querySelector test.

Received on Friday, 25 September 2009 10:42:47 UTC