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

I have also needed this on several occasions. At the moment, you need to (at the minimum) inspect `assignedNodes`/`assignedElements` to determine this, and then add css classes to elements to modify styling. This is far from ideal for such a common use case. 

A typical use case for me is to hide (`display:none`) a `<slot>` if it is has no assigned content. The reason being that i often set a slot's `display` to something other than `contents` e.g. making a slot a flex container so that i can use `gap` to space slotted children. 

So being able to target a slot with assigned content is the most pressing use-case. Though I think it's also worth considering whether there should be separate pseudo-class for each of these states:

* assigned content
* default content
* empty (i.e. no default or assigned content)

-- 
GitHub Notification of comment by WickyNilliams
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6867#issuecomment-1134484141 using your GitHub account


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

Received on Monday, 23 May 2022 10:15:52 UTC