[css-conditional-4] Reconsider disabling unforgiving parsing in `selector()`
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Description
It has been resolved to disable forgiving parsing in selector(). The initial motivation was to add styles based on user agent restrictions on :has() argument, which was previously <forgiving-relative-selector-list> but is now <relative-selector-list>.
Outdated browser interoperability issue
Chrome and FF seem to disagree on forgiving invalid selectors in selector(): in the following test case, text is red, not underlined in Chrome, and is neither red or underlined in FF.
<style>
@supports selector(:is(undeclared|div)) { /* Forgiving :is() */
div { color: red }
}
@supports selector(:not(undeclared|div)) { /* Unforgiving :not() */
div { text-decoration: underline }
}
</style>
<div>text</div>
Also, should selector(:is()) evaluate to true or false? Chrome and FF also disagree on this.
I do not have a strong opinion but I find it a bit surprising that selector(:is(::before, div)) must evaluate to false whereas :is(::before, div) selects any div. If the author wants to test the support of pseudo-elements, he can write selector(::pseudo) or selector(:not(::pseudo, ::another-pseudo)).
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
Read the resolution in w3c/csswg-drafts issue 7280 and the CSS Conditional Rules Level 4 selector() definition linked here. Review the outdated interoperability example only to understand the original concern; this issue is done only if the specification's parsing behavior has an agreed resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100