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

@domenic thanks for the clarification!

> It's inside the options bag passed to customElements.define(). We don't modify createElement.

Ah, so it's better than you have to specify for each createElement() with correct combination of
element's name and corresponding stylesheet.  Sounds nice.

> And if you attach a shadow root, it does not show up in shadowRoot.styleSheets. That's why we keep
 > saying it's unrelated to shadow roots.

Okay, so it's fine not to expose the shadow root in the `.styleSheets`.

So what happens in the following case?

```js
var css = new CSSStyleSheet(':host > span { color: blue; }');
customElements.define('my-element', MyElement, { stylesheet: css });
```
and

case 1
```html
<my-element>
  <span>Hello, World</span>
</my-element>
```

case 2
```html
<my-element>
  <#shadow-root>
     <span>Hello, World</span>
  </#shadow-root>
</my-element>
```

So only in case 2 you see blue "Hello, World"?
(In other words, can we have a selector to make case 1's Hello World blue?)

(Sorry, this may be what Polymer folks asked yesterday, but let me clarify...)

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

Received on Thursday, 8 March 2018 05:19:20 UTC