Re: [csswg-drafts] [selectors-4]Why "Pseudo-elements cannot be represented by the matches-any pseudo-class"?

The reason is that pseudo-elements, semantically, contain a combinator in them - if you start with `.foo`, extending to `.foo.bar` gives you a subset of the same elements, while extending to `.foo::bar` gives you something *completely different*, like `.foo > .bar` would.

`:matches()`, on the other hand, is definitely a pseudo-class - it should only return a subset of the elements that the selector without `:matches()` returns.  Pseudo-elements thus don't really make sense in there.

Further, say you have something like `.foo:matches(::before):hover` - what does that mean? Is it the same as `.foo:hover::before`, or `.foo::before:hover` (those are different and both valid!)? Normally we can arbitrarily re-order the non-pseudo-element simple selectors in a compound selectors, including pseudo-classes, but if ::before is allowed maybe we wouldn't be able to do that any more?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2284#issuecomment-363957055 using your GitHub account

Received on Thursday, 8 February 2018 00:13:03 UTC