Re: [selectors-api] References to Selectors 4

On 04/03/2013 06:39 PM, fantasai wrote:
> http://www.w3.org/TR/selectors-api2/#the-scope-pseudo-class
>
> This section has already been copied to Selectors 4 (and has been
> for awhile, actually), so should be removed here and replaced with
> references to Selectors 4.
>    http://www.w3.org/TR/selectors4/#the-scope-pseudo
>
> If there's anything that needs to be fixed in Selectors 4 for this
> to be viable, then let us know and we'll fix it. :)
>
> http://www.w3.org/TR/selectors-api2/#grammar
>
> Tab just updated the grammar productions in Selectors 4 and defined
> some terms, so this section shouldn't need to define anything, just
> reference Selectors 4.
>    http://dev.w3.org/csswg/selectors4/#grammar
>
> http://www.w3.org/TR/selectors-api2/#processing-selectors
>
> We also added the algorithm for absolutizing a relative selector to
> the Selectors 4 spec, so you can reference "scope-relative selectors",
> as defined here:
>    http://dev.w3.org/csswg/selectors4/#scoping
>
> Please let us know if there are any errors.
>
> We'll try to publish a new WD soon with the updated definitions.

So, the new WD has been published:
   http://www.w3.org/TR/selectors4/#scoping

However, in response to some Shadow DOM stuff [1] we've had to split
out the relative selectors section some more.
   http://dev.w3.org/csswg/selectors4/#relative

While doing that, we noticed a problem with the absolutizing algorithm
in Selectors API2: if you explicitly pass in an empty reference element
set, document.find() searches the whole document. It should instead
return nothing.

Example:
   document.find('img', [list-of-links]) /* find all images inside links */

   Suppose the dynamically-generated [list-of-links] happens to be empty.
   It returns all the images in the document, a very unexpected result.

We suggest that Selectors API 2 be updated to say that if a reference
element set is not given, the selector is assumed to be absolute (and
is parsed and interpreted accordingly) instead of relative.

Relevant terms in Selectors 4:
   relative selector, defined in #relative
   reference element set, used in #relative and #the-scope-pseudo
(We removed "contextual" because it seemed excessively verbose.)

~fantasai and TJ

Received on Thursday, 2 May 2013 20:34:07 UTC