Skip to content

[css-selectors] Reconsider removing selector list invalidation #3082

Open
@ExE-Boss

Description

@ExE-Boss

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 list12.

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 dumb3 legacy mistake can be fixed by getting rid of selector list invalidation.

Footnotes

  1. An actual selector list I once wrote:

    /* 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:

  3. Yes, I have a very strong opinion about this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions