Re: [csswg-drafts] [css-cascade-6] Strong vs weak scoping proximity (#6790)

I don't think that's a good analogy at all.

Strong scoping proximity is much more similar to `@layer`, in that it allows authors to, well, layer styling rules on top of each other and give them control over what takes precedence.

Strong-proximity scopes would fill a very similar role, except they would allow categorically overriding rules only for certain parts of the DOM. The problem with `!important` is that it automatically promotes a rule to the very top where it overrides everything else, except other `!important` rules, so it essentially just creates a two-class system for styling rules, which is really hard to work with. It only really worked for the case of having some working framework code and adding specific overrides to a page, but not for stacking frameworks or just manage conflicting rules from different components (in the broad sense, not the *components* sense).

Adding opt-in strong proximity scopes would have the same effect as adding `@layers`, in that it could be stacked, so we could just say "Anthing inside this thing should look like this, anything inside this other thing should look like that" on the CSS side, then just nest the two things in whichever order we want in the HTML.

This system would still be open to extension by simply adding new strong scopes that override styles locally. This could probably best be compared to shadow-dom in how it over-rides styles locally, except it would be independent from the application logic and purely a styling thing.

But again, that could easily be something to add later, and weak proximity is a good default. Maybe opt-in strong scoping should get its own issue so the question of which is default can just be closed already.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 16 March 2023 10:51:21 UTC