W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

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

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Thu, 08 Feb 2018 00:12:11 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-363957055-1518048730-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:24 UTC