Description
The :is()
, :not()
, and :where()
pseudos all have text that states that if the final compound selector in their arguments doesn't have a type selector, we ignore the general rule that requires them to match the default namespace (when one exists).
(That is, given @namespace "http://example.com";
, a selector like .foo
is implicitly only selecting elements from that default namespace; you have to explicitly write *|*.foo
to get back to the normal behavior of allowing any namespace to match. This doesn't apply to :is()
/etc arguments.)
This special behavior exists to ensure that the combo pseudoclasses intuitively work correctly when used as syntax sugar; that is, given any selector AB
, replacing it with A:is(B, C)
is guaranteed to match all the same elements, and possibly more. See #5684 for more details.
This same argument should apply to the n of A
arguments to :nth-child()
/etc: going from AB
to A:nth-child(n of B)
should match the exact same elements. Currently (lacking the special rule that :is()
/etc have), this isn't necessarily true; changing svg|a.foo
to svg.a:nth-child(n of .foo)
makes it stop matching anything at all, if the default namespace is not SVG.