[selectors4] Absolutizing and nested pseudo-functions

The rules on absolutizing relative selectors include the following (my
emphasis added):

"Otherwise, if the selector does not contain any instance of the
:scope pseudo-class (either at the top-level *or as an argument to a
functional pseudo-class*), prepend :scope followed by the white space
form of the descendant combinator." [1]

So, for example, when absolutizing the argument of :has() in

  E:has(a :matches(:scope b c))

the :scope would not be prepended because of the occurrence inside :matches().

Are there use cases for not prepending :scope when it is an argument
to a functional pseudo-class?

If my selector algebra is right, the above example is equivalent to

  E:has(b :matches(a c))

so it is at worst redundant. But other examples are more problematic.
The selector

  E:has(a:not(:scope))

doesn't just search below E, but must search everywhere else in the
tree for an 'a' element. Similarly for

  E:has(a:has(:scope b))

in which the :scope is in no way connected to E. Neither of these
cases seem to me like intended uses.

Therefore, if there are no use cases for it, I would like to propose
removing "or as an argument to a functional pseudo-class" from the
above rule.

Mark

[1] https://drafts.csswg.org/selectors-4/#absolutizing

Received on Tuesday, 10 May 2016 09:06:06 UTC