Re: [w3c/webcomponents] Provide a lightweight mechanism to add styles to a custom element (#468)

>From my lesser understanding of all these components compared to you guys, it seems as though ShadowDOM roots are designed to be the units of encapsulation for DOM. If that is the case, it seems like encapsulating styles in this programmatic manner might be a better fit for the `el.createShadowRoot` method. For example:

```js
el.createShdowRoot({styles: ':host {display: block; }')
```

This seems to make more sense because `:host` refers to the host of a shadow root where the style is located. The reason this seems to be a better fit is because there's nothing that prevents a Custom Element from having multiple shadow roots, so `:host` in the style of a custom element is ambiguous (as implied by @tabatkins above).

TLDR, would it make sense to move this programmatic definition of a style onto shadow roots where such styles already make sense, instead of on Custom Elements where we have to define new mechanisms to deal with the ambiguity and style scoping?

---
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-214826823

Received on Tuesday, 26 April 2016 17:52:38 UTC