Skip to content

EXPAND :has() to include support for more pseudo-classes #555

Closed

Description

@jensimmons

Description

:has() is amazing.
Developers are thrilled.

Some of the most interesting usecases are when you put another pseudo-class inside of :has(). For example, :has(:playing) targets an element if there's a video or audio element playing inside of it. :has(:user-invalid) targets an element if there's a form field inside of it that's in an invalid state — making it very easy, for example, to create a red border on a text label when its field is not filled out correctly.

It would be great to see if we can get support for all of the pseudo-class (except, of course, for the ones that are disallowed in the standard).

I started a spreadsheet to try and list what's currently supported where: https://docs.google.com/spreadsheets/d/1NZeNiJqOEiphHJiAIB9iWsp2yxsn8fsqAJj1syM6K10/edit?usp=sharing

It needs work, but the list of the pseudo-classes alone are helpful.

Specification

https://drafts.csswg.org/selectors/#relational

Open Issues

No response

Tests

No response

Current Implementations

  • Blink
  • Gecko
  • WebKit

Standards Positions

No response

Browser bug reports

No response

Developer discussions

No response

Polls & Surveys

No response

Existing Usage

No response

Workarounds

No response

Accessibility Impact

No response

Privacy Impact

No response

Other

No response

Activity

  1. changed the title [-]Extend :has() to include support for pseudo-classes[/-] [+]EXPAND: :has() to include support for pseudo-classes[/+] on Oct 5, 2023
  2. changed the title [-]EXPAND: :has() to include support for pseudo-classes[/-] [+]EXPAND `:has()` to include support for pseudo-classes[/+] on Oct 5, 2023
  3. dbaron commented on Oct 6, 2023

    @dbaron
    Member

    Are there particular examples of pseudo-classes where:

    • an engine supports :has(),
    • an engine supports the pseudo-class,
    • the pseudo-class isn't forbidden by the spec from matching inside of :has(), and
    • the engine doesn't support the pseudo-class inside of :has()?

    (I just tested :hover and :checked inside of :has() in Chrome Canary, and they worked fine.)

  4. nt1m commented on Oct 7, 2023

    @nt1m
    Member

    @dbaron Matching works fine in most browsers, it's mostly invalidation that needs work, although both Chrome & WebKit have made progress in that area over the past year.

  5. foolip commented on Oct 10, 2023

    @foolip
    Member

    A list of tests will be need to evaluate the work required for this proposal, as it's not clear if there are things that don't work in Chrome here, beyond pseudo-classes that aren't supported at all yet.

  6. changed the title [-]EXPAND `:has()` to include support for pseudo-classes[/-] [+]EXPAND `:has()` to include support for more pseudo-classes[/+] on Oct 10, 2023
  7. bennypowers commented on Oct 18, 2023

    @bennypowers

    Does this include :host(:has())?

  8. jgraham commented on Feb 1, 2024

    @jgraham
    Contributor

    Thank you for proposing EXPAND :has() to include support for more pseudo-classes for inclusion in Interop 2024.

    We wanted to let you know that this proposal was not selected to be part of Interop this year.

    We could not find any tests for EXPAND :has() to include support for more pseudo-classes in the Web Platform Tests. Such tests are crucial for measuring interoperability status and progress. Once there are WPT entries covering this proposal, we welcome it being resubmitted for a future round of Interop.

    For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2024!

    Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions