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

> > > * Styling elements that do not otherwise need a shadow root
> > Could you give us a concrete list of those elements?
>
> This is an unbounded set of author-created elements, so no, a "concrete list of those elements" can't be provided.  Justin can probably give a few examples from their own code, tho.

I think you misread my comment.  I said a "concrete list", not a "complete list".

> As Justin said, in cases where you don't actually need a shadow tree (your custom element is a container with special powers, that doesn't need to provide any special shadow structure), requiring a shadow root + style element is a cost without a benefit.

We don't think having an extra shadow root and a style element is a cost compared to the cognitive cost of having to remember yet another way to specify style rules.  Now in addition to UA & user stylesheets, style rules in document, shadow trees, and inline style declarations, authors need to be aware of style rules that come from custom element definitions.  All these complexities makes it harder to authors to reason about already convoluted style resolution.  We don't want to make web components so complex that only people working on browsers and libraries can understand.

> > Could you list a concrete use case and what those undesirable side effects are?
>
> We're just talking about standard specificity battles.  You don't have to worry about fighting with another selector when overriding UA styles; they lay the default groundwork, and you can override freely; even if they respond to state in some way, which would require higher-specificity selectors, you can still override without worry.

Why does having a style element inside a shadow tree not solve this problem?  Rules in such a style element has a different cascading order than the one author apply outside the shadow tree.

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

Received on Wednesday, 27 April 2016 04:30:56 UTC