You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The functional :has() CSS pseudo-class represents an element if any of the relative selectors that are passed as an argument match at least one element when anchored against this element. This pseudo-class presents a way of selecting a parent element or a previous sibling element with respect to a reference element by taking a relative selector list as an argument.
Example:
/* Selects an h1 heading with aparagraph element that immediately followsthe h1 and applies the style to h1 */h1:has(+p){margin-bottom:0;}
We still have a few months left in 2023 so there's a chance this might get implemented in Gecko, in which case this doesn't need to be part of interop 2024. 🤷
Reacted by Vladimir Agafonov, mark-dropbear, Roman Komarov, Guido Slotboom and BearCoder
i'll wait for this to show up in Firefox stable (i believe v119) then close this issue
No, please do not close this issue, @mayank99. The group planning Interop 2024 will consider whether or not we want to carry this focus area over until the next year. We might have reasons to keep working on :has().
I started a spreadsheet of all the pseudo-classes that could be supported inside of :has(), hoping to figure out who supports what, with the goal of getting this data submitted to MDN's BCD project (where it would all get surfaced on Can I Use).
I think it'd be terrific to create tests for all of these, and add them to Interop 2024. Being able to use pseudo-classes inside of :has() significantly increases their usefulness. 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.
Activity
foolip commentedon Sep 18, 2023
@mayank99 it sounds like you probably know this, but this is part of https://wpt.fyi/interop-2023. We're going to evaluate all current proposal for carryover into 2024, and I'll take you filing this issue as a vote in favor of keeping
:has()if it isn't done by the end of the year.BearCooder commentedon Sep 19, 2023
Firefox has enabled :has() support on Nightly! Should be in tomorrow's build.
https://bugzilla.mozilla.org/show_bug.cgi?id=1853701
mayank99 commentedon Sep 20, 2023
i'll wait for this to show up in Firefox stable (i believe v119) then close this issue
foolip commentedon Sep 21, 2023
I've added the carryover-evaluation label as this is about continuing/expanding an existing focus area.
jensimmons commentedon Sep 21, 2023
No, please do not close this issue, @mayank99. The group planning Interop 2024 will consider whether or not we want to carry this focus area over until the next year. We might have reasons to keep working on
:has().mayank99 commentedon Sep 21, 2023
ah ok, i'll keep it open then.
jensimmons commentedon Sep 21, 2023
I started a spreadsheet of all the pseudo-classes that could be supported inside of
:has(), hoping to figure out who supports what, with the goal of getting this data submitted to MDN's BCD project (where it would all get surfaced on Can I Use).https://docs.google.com/spreadsheets/d/1NZeNiJqOEiphHJiAIB9iWsp2yxsn8fsqAJj1syM6K10/edit?usp=sharing
I think it'd be terrific to create tests for all of these, and add them to Interop 2024. Being able to use pseudo-classes inside of
:has()significantly increases their usefulness. 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.jensimmons commentedon Sep 21, 2023
(Here's the rest of the list on the spreadsheet, or click the link above. Anyone should be able to access it.)
[-]CSS `:has()` pseudo-class[/-][+]Carryover evaluation: CSS `:has()` pseudo-class[/+]jensimmons commentedon Oct 5, 2023
I opened a new proposal for the idea of extending
:has()#555