[csswg-drafts] [selectors] Pseudo class to indicated when a slot has content (#6867)

plinss has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] Pseudo class to indicated when a slot has content ==
I'm developing several web components and I'm finding a need to tell when a slot has content or not. (e.g. to apply margins or not so empty slots don't impact layout, but layout well when they do, etc.)

The :empty pseudo-class applies when the slot doesn't have direct content, even when it has slotted content, so doesn't work. Using slot:has(::slotted(*)) wouldn't detect text-only content.

Once possibility would be to redefine :empty to detect slotted content, but it may be useful to keep the current behavior to differentiate empty slots from slots with default content (and the change may break exiting content). So a new pseudo-class that only detects slotted content may be useful. 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6867 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 8 December 2021 16:02:04 UTC