#999: CSS Scoping; :has-slotted
Discussions
2024-10-14
Lea: Think this is ready. It's a pseudo-class that applies to <slot>
elements when they have assigned nodes. We ought to make :slotted
a combinator so you can use :has()
for similar things, but we still need something that catches text nodes. Didn't call it :fallback-displayed
because there's no guarantee that it has a fallback.
Peter: Seems like an no-brainer. My only "hmm" is a vague memory of doing this without the pseudo-element.
Lea: You posted the original proposal: https://github.com/w3c/csswg-drafts/issues/6867.
<blockquote> We discussed this in a breakout today and we don't see any architectural concerns with this, so we're happy for this to move forwards. </blockquote>Lea: Side-note: I don't like when the CSSWG uses pseudo-elements to address real DOM elements. It introduces a host of ergonomics problems that would not otherwise exist.
Peter: I'd like ::part()
to be replaced by a way for the shadow tree to define its own pseudo-elements.
Lea: I'd like ::part()
and ::slotted()
to be replaced by ways to target real elements, e.g. special combinators to expose other elements. But that's a very big conversation that we cannot have in 5 minutes.
OpenedSep 30, 2024
こんにちは TAG-さん!
I'm requesting a TAG review of
:has-slotted
.The :has-slotted pseudo-class matches slot elements which have a non-empty list of slotted nodes. When :has-slotted matches a slot with fallback content, we can conclude that the fallback content is not being displayed.
Further details:
You should also know that...