[css-selectors] Reconsider removing selector list invalidation
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 24
Description
https://drafts.csswg.org/selectors-4/#grouping
Warning: the equivalence is true in this example because all the selectors are valid selectors. If just one of these selectors were invalid, the entire selector list would be invalid. This would invalidate the rule for all three heading elements, whereas in the former case only one of the three individual heading rules would be invalidated.
I wasn’t aware of that for a long time and wrote many of my stylesheets with the assumption that a single unknown selector in a selector list wouldn’t invalidate the whole selector list[^1][^2].
Even in the specification, global selector list invalidation is said to be considered a legacy mistake in appendix B.
I propose to run a web study, similar to what Chrome did in #2156 to see if this very dumb[^3] legacy mistake can be fixed by getting rid of selector list invalidation.
[^1]: An actual selector list I once wrote:
css
/* The `[data-ie]` attribute contains the string "legacy" for IE8 or older,
and IE8 only supports the single‑colon `::before`/`::after` syntax */
html[data-ie~="legacy"] pre.line-numbers:before,
pre.line-numbers::before {
content: "1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9\A 10…"; /* all the way up to 9999 */
}
[^2]: Current known issues caused by this legacy mistake:
- MDN bug 1487656 (https://github.com/mozilla/kuma/pull/4961)
- #2156
[^3]: Yes, I have a very strong opinion about this.
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 by reviewing the Selectors 4 grouping section and Appendix B compatibility note, then compare the prior web-study discussion in #2156. Define a web study that measures the impact of removing selector-list invalidation and use its compatibility findings to determine whether the proposed specification change is viable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100