- From: Takayoshi Kochi <notifications@github.com>
- Date: Thu, 08 Mar 2018 10:56:12 +0000 (UTC)
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 8 March 2018 10:56:34 UTC
@annevk Do we need a way to give full UA-like style including descendants for this case?
E.g. Imagine `<cool-list>` and `<cool-item>`, both are quite dumb custom element that only needs styling. But specifically, `<cool-list>` wants to have style for `<cool-item>` when they are direct children under the element.
You want this UA-like stylesheet.
```css
cool-list {
... (A)
}
cool-item {
... (B)
}
cool-list > cool-item {
... (C)
}
```
So (A) and (B) can be achieved by adding `:host { ... (A) }` and `:host { ... (B) }` to the custom element registry for each, the (C) is problematic in this case.
One pessimistic idea is just giving up for such case to provide UA-like shadow for custom elements, and ask authors write its shadow DOM and style accordingly, such as
```html
<cool-list>
<#shadow-root>
<style>
:host > * { display: none; }
:host > cool-item { display: list-item; ... (C) }
</style>
<slot></slot>
</#shadow-root>
</cool-list>
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/468#issuecomment-371453775
Received on Thursday, 8 March 2018 10:56:34 UTC