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

> Right, as per those issues you linked in your edit, [leading (and trailing) whitespace is trimmed by the Syntax spec](https://drafts.csswg.org/css-syntax/#consume-declaration) before anything else has a chance to see the value [...].

`style.setProperty(prop, value)` (or `style[prop] = value`) does not seem to run **consume a declaration** (the linked procedure), which seems to be only used for `style.cssText = 'prop: value'`, or any other procedure that would trim trailing whitespaces. Do they need to be trimmed for both interfaces?

```js
e1.style.color = 'var(--color)  '
e2.style = 'color: var(--color)  ;'
e1.style.color === e2.style.color // ?
```

Am I missing something or is it missing from [parse a list of component values](https://drafts.csswg.org/css-syntax-3/#parse-a-list-of-component-values)?

```diff
 1. Normalize input, and set input to the result.
- 2. Repeatedly consume a component value from input until an `<EOF-token>` is returned, appending the returned values (except the final `<EOF-token>`) into a list. Return the list.
+ 2. Repeatedly consume a component value from input until an `<EOF-token>` is returned, appending the returned values (except any trailing whitespaces and the final `<EOF-token>`) into a list. Return the list.

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


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

Received on Monday, 27 December 2021 10:02:46 UTC