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

I believe such thing would be implementable, but doing two selector-matching / cascade passes is worrying, performance-wise. I guess it's what we do for links / `:visited` in some cases, but having to do that for all elements seems very unfortunate...

At a glance, there doesn't seem to be not a particularly easy way of avoiding extra work if you don't use this feature (at least not without penalizing performance for the users of this feature). Though it's late and I might have overlooked something. Here's my reasoning:

It seems to me you need to do a first pass collecting const-properties basically unconditionally (because you don't know if they're used until you cascade)... You could optimistically assume they're not used, and do the regular cascade during this first pass. If they're indeed not used, you can just not do the second pass and carry on, so perf remains ~the same as it is now. But if they are, you've wasted a bunch of work that now you need to throw away because you're going to re-selector-match etc.

In general I'm a bit skeptic of adding features that are performance footguns... But again I might need to think a bit harder about potential ways of optimizing this because I might have overlooked some way of make them cheaper.

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


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

Received on Sunday, 31 January 2021 23:23:42 UTC