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

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

After this issue was brought up, I gave some thoughts on it, and my understanding of CSS 2.1 is that:

1. Semantically it looks more like a scoped to the element, and making it stronger is intuitive.
2. It allows JS to override rules by setting style attributes to `display:none` (or vice versa) to toggle.

For those reasons, and since it's already at the top of the specificity, it makes sense for Scoped to bring it up further, to the highest in Scoped criteria.

Now for the Shadow DOM criteria, as @rune-opera mentioned, it only affects `::content` and such tree-boundary-crossing-rules, so not doing the same originally made sense to me, and I still like its simplicity.

On the other hand, when component user sets, say, `::content my-item { display:flex }`, component authors must use `!important` to style attributes if we go with option 1. It may be rare in the current design, but needing "!important" to style attributes does not look very intuitive, and may break many libraries such as jQuery .hide(). From that view point, I agree with @rniwa, option 2 gives more familiar experiences to web developers.

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

Received on Wednesday, 9 September 2015 14:21:50 UTC