Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[selectors-4] Text of the "Compound selector" definition misses the Pseudo-elements part #5676

Closed
SelenIT opened this issue Oct 28, 2020 · 6 comments

Comments

@SelenIT
Copy link
Collaborator

SelenIT commented Oct 28, 2020

Currently, the formal grammar of the Compound selector is

<compound-selector> = [ <type-selector>? <subclass-selector>*
                        [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!

i.e. pseudo-elements (possibly pseudo-classed) can be part of Compound selector.

However, the definition of Compound selector in prose states that

A compound selector is a sequence of simple selectors that are not separated by a combinator, and represents a set of simultaneous conditions on a single element.

and the formal grammar of the simple selector excluded pseudo-elements (since the resolution of #386). (As a side note, the current formal grammar seems to imply that the "bare" pseudo-element, like ::before, technically falls under the Compound selector definition.)

Shouldn't the text of the Compound selector definition be amended somehow to make it more clear that pseudo-elements also belong to it?

@Loirooriol
Copy link
Contributor

I guess this is basically the issue at the end of that section:

ISSUE 1 - Pseudo-elements aren’t handled here, and should be.

@fantasai
Copy link
Collaborator

fantasai commented Dec 9, 2022

Fixed in 80e9be7 and ae832ae

Compound selectors still don't include pseudo-elements, but we added a new term “pseudo-element compound” to address that and integrated it into the definition of complex selectors.

@Loirooriol
Copy link
Contributor

A complex selector is a sequence of one or more compound selectors and/or pseudo-compound selectors
separated by combinators.

So div::before and ::before::marker are not complex selectors since the compound/pseudo-compound selectors are not separated by combinators?

@tabatkins
Copy link
Member

No, they're complex selectors. The text is just written in a slightly ambiguous way, because precisely reflecting the grammar into English would be very fiddly and it's not necessary, since the grammar is the part that's normative.

@Loirooriol
Copy link
Contributor

The text is still normative. It's fine if the text is looser than the grammar, but if it's stricter then it's adding additional constraints. So I would change to:

A complex selector is a sequence of one or more compound selectors and/or pseudo-compound selectors, possibly separated by combinators.

@tabatkins
Copy link
Member

All right, ended up rewriting the complex selector section a bit, and tweaking pseudo-compound as well.

jakearchibald pushed a commit to jakearchibald/csswg-drafts that referenced this issue Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants