Re: [csswg-drafts] [cssom-1] How to serialize specified value of properties with a var()? (#6484)

Please allow me to explain the issue more clearly:

**Case 1:** `style.cssText = 'color: var(--color) ;'`

1. [parse a CSS declaration block](https://drafts.csswg.org/cssom-1/#parse-a-css-declaration-block)
2. [parse a list of declarations](https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-declarations)
3. [consume a list of declarations](https://drafts.csswg.org/css-syntax-3/#consume-a-list-of-declarations)
4. [consume a declaration](https://drafts.csswg.org/css-syntax-3/#consume-a-declaration)

Result: `var(--color)'`, ie. the trailing whitespace *is trimmed*.

**Case 2:** `style.color = 'var(--color) '` or (alias) `style.setProperty('color', 'var(--color) ')`

1. [parse a css value](https://drafts.csswg.org/cssom-1/#parse-a-css-value)
2. [parse a list of component values](https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-component-values)
3. repeatedly [consume a component value](https://drafts.csswg.org/css-syntax-3/#consume-a-component-value)

Result: `var(--color) '`, ie. the trailing whitespace *is not trimmed*.

---

I was suggesting a change above to preserve the trailing whitespace but please note that this inconsistent behavior does not matter to me. Does it matter for any reason, eg. round-tripping? I'm just trying to match the (expected) browser outputs for both interfaces.

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


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

Received on Sunday, 6 March 2022 14:56:54 UTC