Re: [csswg-drafts] [css-variables?] Higher level custom properties that control multiple declarations (#5624)

Ok, I see the value proposition better thanks to your explanation. You're saying that by doing this in css you can also support things like `html.dark-theme svg.icon {--const-accent-color: royalblue}` and, unlike with my proposal, not worry about having a Javascript keep the `data-accent-color` attribute in sync when the dark-theme class on `<html>` is added or removed (or more complex situations, selectors being powerful). 

This is a valid point, thanks for bringing this up. There is a hefty price for that value proposition though. I still feel the attributes improvements are more likely to land and are in many cases sufficient while not incurring performance costs, but I agree this is something that can be done independently and doesn't remove all the value from this proposal.

Digging deeper, you seem to be proposing to add something like Tab's CAS proposal to CSS but restrict it to a subset of custom properties instead of all attributes. At this point if we are about to add a second cascade pass I wonder if we can't try to make it at least more useful by making it affect more things, like actually update data attributes? (but that might be more complex to implement too, I'm just throwing that out there to get us all thinking about other use cases for a second css cascade; don't want to bandwagon just try to see if we can get other benefits eventually or if it's a one-off). 

I'm saying that because often the attributes in the web components do not only affect style: they also affect the structure of the component itself, in which case a css only solution isn't viable anyway because you can't react to it to change your tree.

Btw I'm not sure I like const as a prefix. These things are not constants they are just evaluated eagerly. I'd rather find a better name of we go that route.

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


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

Received on Friday, 5 February 2021 09:02:59 UTC