Skip to content

Modern definition of :empty #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Westbrook opened this issue Oct 7, 2024 · 5 comments
Closed

Modern definition of :empty #794

Westbrook opened this issue Oct 7, 2024 · 5 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@Westbrook
Copy link

Description

In Selectors level 4 the CSSWG has spec'd that the :empty pseudo-class will now match when the only contents of an element are white space, e.g. all of the following match :empty:

<p></p>
<p>
<p> </p>
<p></p>

Browsers do not currently deliver this capability, even while developers expect this behavior.

Specification

https://drafts.csswg.org/selectors-4/#the-empty-pseudo

Additional Signals

No response

@gsnedders
Copy link
Member

See also #180 and w3c/csswg-drafts#1967 about whether this change is web compatible.

@gsnedders
Copy link
Member

https://wpt.fyi/results/css/selectors/selectors-empty-001.xml?run_id=5141001291431936&run_id=5160261803835392&run_id=6263739599028224&run_id=5140230613237760 is still asserting the old (Selectors < 4) behaviour, and is still passing everywhere. It seems like nobody wants to take the risk of making the breaking change, moving away from interoperability?

@wpt-interop
Copy link
Collaborator

Thank you for proposing Modern definition of :empty for inclusion in Interop 2025.

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

On behalf of the entire Interop team, thank you for submitting this proposal for consideration. We got many more proposals than we could include in this year's project, necessitating some difficult choices. Please note this should not be taken as a comment on the technology as a whole, or our willingness to consider it for Interop in the future. We appreciate the work you put into your proposal, and would welcome your participation in future rounds of Interop.

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

Posted on behalf of the Interop team.

@KyNorthstar
Copy link

KyNorthstar commented Feb 14, 2025

this proposal was not selected to be part of Interop this year.

Can you share the reasoning behind this decision?

@foolip
Copy link
Member

foolip commented Feb 17, 2025

@KyNorthstar the discussion in #180 is still mostly relevant. At the time, @lilles added https://chromestatus.com/metrics/feature/timeline/popularity/2624 to gauge the risk of changing :empty, and it looks to be very high.

Doing the standards work itself is out of scope of the Interop project, but it looks like the direction will have to be a new pseudo-class that has the desired behavior. w3c/csswg-drafts#1967 is tracking making a decision. It's clear there is a pain point here, so once there is a spec (and tests) I hope there would be progress on the implementation side.

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
Status: Done
Development

No branches or pull requests

5 participants