standards-positions icon indicating copy to clipboard operation
standards-positions copied to clipboard

[css-variables-1] Short-circuiting var(), attr(), env()

Open andruud opened this issue 5 months ago • 1 comments

WebKittens

No response

Title of the proposal

[css-variables-1] Short-circuiting var(), attr(), env()

URL to the spec

https://drafts.csswg.org/css-variables/#replace-a-var-function

URL to the spec's repository

No response

Issue Tracker URL

No response

Explainer URL

No response

TAG Design Review URL

No response

Mozilla standards-positions issue URL

https://github.com/mozilla/standards-positions/issues/1224

WebKit Bugzilla URL

No response

Radar URL

No response

Description

In https://github.com/w3c/csswg-drafts/issues/11500, the CSSWG resolved to make all substitution functions short-circuiting, meaning that we don't evaluate branches we don't care about (not even to look for cycles). In the issue, we were not sure if we could actually apply this resolution to var() due to certain tricks that rely on the existing behavior. However, my compat investigation did not find any evidence of this trick being in widespread use, and I consider this a safe change to make.

andruud avatar May 07 '25 08:05 andruud