[csswg-drafts] [css-values-5] `var()` fallback containing a positioned `{}` (#12625)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-5] `var()` fallback containing a positioned `{}` ==
`opacity: var(--custom, {} 1)` is valid in Chrome and FF today but is invalid per [spec](https://drafts.csswg.org/css-values-5/#component-function-commas):

  > the `<declaration-value>` defined for the fallback value of `var()` [...] follows the standard comma-containing production rules when it does start with a "{" token

The aforementioned related rule is:

  > If it does start with a "{" token, then the production matches just the {} block that the "{" token opens.

This was introduced following the resolution in #9539.

A positioned `{}` is valid only in a custom property value therefore any declaration value would be invalid at computed value time after substituting the fallback of `var(--custom, {} 1)` or `var(--custom, 1 {})`.

However, `var(--custom, 1 {})` is valid, per spec:

  > the `<declaration-value>` defined for the fallback value of `var()` [...] ignores the rules restricting what it can contain when it does not start with a "{" token: it is allowed to contain commas and {} blocks.

So I suspect this breaking change is not intentional.

This was a follow-up of this [comment](https://github.com/w3c/csswg-drafts/issues/9539#issuecomment-2689050085).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12625 using your GitHub account


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

Received on Tuesday, 19 August 2025 19:26:34 UTC