- From: Dave Batiste <notifications@github.com>
- Date: Wed, 14 Jul 2021 20:14:50 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 15 July 2021 03:15:05 UTC
I've encountered the need for this many times and I think this would be useful. However, sometimes, knowing whether the slot is empty or not isn't quite good enough because we want to know if the slot contains **visible** elements. If only I could have `:hasSlotted(:visible)` 😄 . The visibility bit aside, I think this should work for the case where there are nested slots. Ex. ```html outer-component --shadowDOM <inner-component> <slot name="outer" slot="inner"></slot> </inner-component> <slot></slot> ... inner-component --shadowDOM <slot name="inner"></slot> ... ``` Given such components, usually I would be interested in the flattened assigned nodes. That is, I would usually consider the `inner` slot not empty in this case... ```html <outer-component> <div slot="outer">...</div> ... </outer-component> ``` But I _would_ usually consider the `inner` to be empty in this case, even though it contains a `slot`. ```html <outer-component></outer-component> ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/936#issuecomment-880359220
Received on Thursday, 15 July 2021 03:15:05 UTC