- From: Emilio Cobos Álvarez via GitHub <noreply@w3.org>
- Date: Wed, 06 Aug 2025 10:57:58 +0000
- To: public-css-archive@w3.org
It's definitely an interesting proposal. It's not _quite_ a slot tho, since a slot contains other elements, and my understanding is that you want the thing to be a replacement for a pseudo-element, not a container for it? Depending on how this turns out (see below) I'd rather use a new element or something (like `<pseudo>` or what not), but haven't thought too deep about it... There are various questions that come up with this, specially regarding generated content... Not necessarily unsolvable tho: * What happens if the slot is not in the right position in the DOM (e.g. `<div><slot name="::after"></slot><slot name="::before"></slot></div>`)? Do we just let it be? * What if the `<slot>` has children? Do those get rendered? Only if there's no content like in shadow dom? * What if the pseudo-element would not be generated, e.g. `content: none`, or `::marker` on something that's not a list-item, or `::backdrop` for something that's not in the top layer? Do we just suppress boxes of the slot, or do we actually honor the `display` property? * Dynamic mutations here seem kinda tricky, depending on how we answer some of these questions. * The contents of `::before` / `::after` are not exposed to author code, and they need some magic (like images that load the content property at a given index or so). Would we expose those to authors? If so we need to define how that would work... For generated content, the `<slot>` is interesting _if_ it would match the `::before` / `::after` rules. Then, in a way, you're just changing the container you're stuffing the generated content into, which is kinda what slot does in Shadow DOM if you squint enough? Behavior is a bit different (`display: contents` rather than inline for the box or so), but the model is reasonable I think... For other pseudo-elements like `::backdrop` and so on tho, you really want the `::backdrop` box to be the `<slot>`s, and you don't care about the contents (because `::backdrop` has no contents)... So the `<slot>` metaphor breaks there a little bit (and I think that's why I'd prefer a new element). The more I think about it the more I think it can work and be a nice model for these pseudos, actually... You just don't generate anonymous elements for these things, and reuse the existing DOM element. Something to think about, even though I'm not sure there are use cases for these, is what to do about elements that are "leafs" like `<input>`, you can't just do `<slot name="::placeholder">` in there... -- GitHub Notification of comment by emilio Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12575#issuecomment-3159612298 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 6 August 2025 10:57:59 UTC