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

Excuse me if I'm completely off, but regarding implementation in @emilio comment https://github.com/w3c/csswg-drafts/issues/5624#issuecomment-770470408 there seems to be an easy way to speed up CSS not using the cost properties: During initial CSS parsing, construct a list of cost properties used in selectors and a list of rules defining const properties.

If either no cost properties are used in selectors, or no rules is defining them, we can avoid the first pass entirely. Else, we can perhaps only do the first cascade pass only on the rules that are actually defining the const properties.

Also, perhaps we might not need to create a new CSS thing for that and just use custom properties as they are today. With just the constraint that when used in selectors, no function interpolation is done. it puts the burden on CSS authors to use it right though and can perhaps cause bugs. Or else, the const property could be just a specific flag set on the custom property such as `html.dark-theme svg.icon { @const --accent-color: royalblue}`.

-- 
GitHub Notification of comment by mildred
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5624#issuecomment-773925083 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:53:21 UTC