Skip to content

[css-conditional-4] Reconsider disabling unforgiving parsing in selector() #8295

@cdoublev

Description

@cdoublev

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

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