Re: [csswg-drafts] [css-scoping] Please bring back scoped styles (#3547)

> Yes: inheritance; no: global styles? When would you ever want to just inherit, but not have access to the global styles?

@Heydon good question! My take on this is that if you don't have global styles then probably inheritance should be opt-in too (as opposed to opt-out / status quo). 

> Who thinks and works like that?

I have spoken with many supporters of styles in JavaScript and apparently they all do this (CSS Modules folks included). I guess they adopt a different strategy to avoid repetition: instead of using global and cascading styles they build up isolated components and reuse those instead. When it is time to tweak styles they then use custom properties or (in JavaScript) "context" by making explicit subscriptions so that they control what is affected by those changes.

FWIW this proposal by Nicole Sullivan sounded interesting to me https://mobile.twitter.com/stubbornella/status/1076144685867982849

@keithjgrant The other day I was playing with another idea https://mobile.twitter.com/giuseppegurgone/status/1089633480458358785 but I am not sure how feasible it is without a way to mark DOM boundaries for the scope. This would be just an addition not a replacement of CSS.

-- 
GitHub Notification of comment by giuseppeg
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3547#issuecomment-458457640 using your GitHub account

Received on Tuesday, 29 January 2019 08:53:15 UTC