Re: [csswg-drafts] [css-variables] Custom properties should *not* serialize "exactly as specified" (#7329)

Note that this also happens (even in Firefox) with an arbitrary substitution containing value:

```js
style.margin = '1px calc(1px / var(--custom)'
style.padding = '1px'

style.margin;  // 1px calc(1px / var(--custom)
style.padding; // 1px
style.cssText; // margin: 1px calc(1px / var(--custom); padding: 1px;

style.cssText += ''

style.margin;  // 1px calc(1px / var(--custom); padding: 1px;
style.padding; // ''
style.cssText; // margin: 1px calc(1px / var(--custom); padding: 1px;;
```

Custom property values are clearly specified as substituted in as a list of tokens. Fallback values are presumably also a list of tokens, assuming [consume a declaration](https://drafts.csswg.org/css-syntax-3/#consume-declaration) implies consuming a list of component values (step 5) while parsing against the grammar, which produces a list of tokens for the fallback values.

And if the other parts of the consumed declaration value (containing an arbitrary substitution) are consumed as tokens instead of component values, this can make a difference as demonstrated above.

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


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

Received on Thursday, 24 July 2025 07:49:40 UTC