[csswg-drafts] [css-variables] Insert empty comments during serialization to separate adjacent tokens (#7328)

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

== [css-variables] Insert empty comments during serialization to separate adjacent tokens ==
```js
var s = document.body.style;
var cs = getComputedStyle(document.body);
s.cssText = "--a:a; --b:var(--a)b; counter-reset:var(--b)";
cs.counterReset; // "a 0 b 0" or equivalent
cs.getPropertyValue("--b"); // ???
```

I have noticed that Firefox serializes `--b` as `"a/**/b"`. this is nice, because then

```js
s.setProperty("--b", cs.getPropertyValue("--b"));
cs.counterReset; // still "a 0 b 0"
```

However, Blink serializes `--b` as `"ab"`, so

```js
s.setProperty("--b", cs.getPropertyValue("--b"));
cs.counterReset; // "ab 0" :(
```

I think https://drafts.csswg.org/css-variables/#serializing-custom-props should standardize what Firefox does in order to have round-trip.

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


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

Received on Saturday, 28 May 2022 21:07:58 UTC