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

> I'm not sure I understand the implications of this: What's the proposed behavior of a custom element with default style and a shadow host? What's the behavior of `!important` on the default style?

This is so that the custom element can define the default style without `!important`, let author override it, and then force certain styles (e.g. some element should always be a block, or have a border, etc...) with `!important`.

> Does it effectively act as a `<style>` element in the first position in the list of the shadow host? That's what I understood, but I want to confirm.

Yes.

> That sounds slightly annoying to implement (with a Gecko hacker hat on), and somewhat confusing to reason about (if I add an `!important` `:host` rule in a shadow root it may or may not necessarily override the custom element style, depending on how we define specificity of `:element` and what not).

I think we have an option of dropping the style added by this mechanism once a shadow root is attached.

> If I understand correctly the reason shadow importance computation is like it is is so the shadow could override everything if needed, is that no longer something we want?

We definitely want that.

> Looks to me that it would be much easier to define as a cascade order right before the shadow root instead of reusing something it might conflict with... But I saw that @rniwa was very opposed to that (I'm curious about why, it seems the most straight-forward way to implement this to me off-hand).

Again, we would be opposed to such a proposal, and we would indeed **NOT** going to implement this feature if that approach is taken.

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

Received on Wednesday, 1 August 2018 02:23:07 UTC