Repository navigation
Open
Labels
focus-area-proposalFocus Area Proposal
Description
Description
The :has-slotted CSS pseudo-class matches <slot> elements where the fallback content is not shown. The pseudo-class matches any slotted content, including white space, text nodes, or elements.
For Interop 2027, it would be great to have the :has-slotted selector available across all engines. It has already landed in Firefox. It is being worked on in WebKit (spec clarifications are being sought) and at one point, it was also being worked on in Chromium. Having this cross-engine would remove the need for hacky JS workarounds.
Specification
W3C
web-feature
Test Links
- https://wpt.fyi/results/css/css-shadow/has-slotted-001.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-002.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-003.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-changing-001.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-changing-002.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-flattened-001.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-flattened-002.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-flattened-003.html?label=master&label=stable&aligned&q=has-slotted
- https://wpt.fyi/results/css/css-shadow/has-slotted-flattened-004.html?label=master&label=stable&aligned&q=has-slotted
The below link shows all tests related to has-slotted including the functional psuedo :has-slotted() that as @emilio points out has not yet been implemented by any browser. Purely for visibility. The above tests are the ones related to the Interop 2027 proposal.
Additional Signals
- https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:has-slotted
- https://groups.google.com/a/chromium.org/g/blink-dev/c/o3ja7zaKuls?pli=1
- [css-shadow] :has-slotted spec contradicts itself w3c/csswg-drafts#14307
Browser positions
Reacted by Westbrook Johnson, Jayden Pearse, Joe Pea, Owen Buckley, jack, Maarten Van Hoof, phantomxx29474, Philipp Gfeller, Martin Shelley, Fabian Bühler and 34 more
Reacted by Owen Buckley, jack, phantomxx29474, Martin Shelley and Reece McDonald
Metadata
Metadata
Assignees
Labels
focus-area-proposalFocus Area Proposal
Type
Projects
- StatusShow more project fieldsTodo
Activity
[-]:has-slotted support[/-][+]CSS :has-slotted support[/+]github-actions commentedon Sep 3, 2026
This comment was automatically generated based on the information you provided. Please don't edit it.
Below is additional information about the web feature (from the web-features project) which is referenced in your proposal.
If this doesn't accurately correspond to your proposal, please update your initial comment to include
web-features: <feature-id>.To find feature IDs, use the web-features explorer.
Feature :has-slotted
:has-slottedCSS pseudo-class matches<slot>elements where the fallback content is not shown. The pseudo-class matches any slotted content, including white space, text nodes, or elements.:has-slottedCSS pseudo-classemilio commentedon Oct 1, 2026
The tests links include the functional pseudo-class which was a bit more controversial and nobody implements (at least yet). Is that intentional?
jackholden commentedon Oct 1, 2026
@emilio I added it initially purely for showcasing all the :has-slotted tests but I didn't take into account the :has-slotted() tests which aren't part of this proposal. I have amended it above to hopefully make it clearer but also happy to completely remove it :)