[selectors] The grammar for :host() and other compound-selector-taking things should probably forbid pseudo-elements
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
I just realized that WebKit (but not Blink nor Gecko) parse the following selector as valid:
:host(::before)
(or :host(::before)::before for that matter).
I was going to file a WebKit bug, but then realized that the grammar technically allows it. This also applies to the grammar of :is / :where (old :matches) etc.
I think that's wrong and pseudo-elements should not be allowed in nested selectors. WebKit itself doesn't parse, e.g., :not(::before), so they're not consistent about it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the selector grammar for :host(), :is(), :where(), and related compound-selector-taking constructs, comparing their treatment of nested pseudo-elements with :not(). Confirm the intended grammar and ensure pseudo-elements such as ::before are rejected in nested selectors while existing valid cases remain accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100