Content-Length: 244155 | pFad | https://github.com/w3c/csswg-drafts/issues/8122

90 [selectors-4] Legacy `:` pseudo-element cannot appear before type/subclass selectors · Issue #8122 · w3c/csswg-drafts · GitHub
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] Legacy : pseudo-element cannot appear before type/subclass selectors #8122

Closed
cdoublev opened this issue Nov 22, 2022 · 3 comments
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. selectors-4 Current Work

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Nov 22, 2022

Chrome/FF seems to parse :before#id or :before.class as invalid (instead of valid and matching nothing) but I do not see on which part of the spec this is based.

Pseudo-elements are featureless, and so can’t be matched by any other selector

This does not make them invalid.

Legacy : pseudo-element syntax is defined in <subclass-selector> as a <pseudo-class-selector>.

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

Subclass selectors can appear in any order while still selecting the same set of elements, but this is not true for a pseudo-element specified with the legacy single : syntax.

Therefore I assume that :before must be handled as if it has been specified with ::before and matched <pseudo-element-selector>. If so, it may be helpfull to define it in the spec.

A similar confusion occurred to me when parsing a <color-stop-list>, whose syntax requires two color stops but its grammar accepts an implicit color stop defining two stops with the same color.

@tabatkins
Copy link
Member

The intent of the additional rule is to say that you can spell a few pseudo-elements with a single colon:

The four Level 2 pseudo-elements (::before, ::after, ::first-line, and ::first-letter) may, for legacy reasons, be represented using the grammar, with only a single ":" character at their start.

I should probably write that out more clearly. I can just merge that into the grammar itself rather than putting it in prose.

tabatkins added a commit that referenced this issue Nov 22, 2022
…self, for clarity. No normative change intended. #8122
@tabatkins
Copy link
Member

And done.

@cdoublev
Copy link
Collaborator Author

Thanks, I am satisfied and happy that I do not have to implement a custom validation.

@tabatkins tabatkins added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Nov 23, 2022
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
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. selectors-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/w3c/csswg-drafts/issues/8122

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy