Re: [webcomponents] [Shadow] Style attributes in Shadow DOM Cascade Order Proposal (#316)

Note that without piercing combinators, the element and its style attribute are always in the outermost shadow tree from which rules are applied.

My reasoning behind suggesting the style attribute declarations should be grouped with the rules from the stylesheets in the same (shadow) tree as the element, is that for:

<style>
my-item { color:green; background:lime !important }
</style>

<my-list>
  <:shadow>
    <style>::content my-item { color:red; background-color: orange !important }</style>
    <content/>
  </:shadow>
  <my-item style="color:green; background:lime !important"></my-item>
</my-component>

whether the style is set through a stylesheet rule or a style attribute in the outer scope, should not affect the cascading order relative to the with the ::content rule in inner scope. With my cascading proposal, you would use !important to override with the ::content rule.

What made me a bit uncertain was the special casing for style attributes for <style scoped> in the css-cascade spec.


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/316#issuecomment-138465018

Received on Tuesday, 8 September 2015 07:48:29 UTC