Re: [csswg-drafts] [cssom-1] Trim the name argument `CSSStyleDeclaration.setProperty()` (#11418)

Ah ok, thanks for letting me know about this.

I see this [test](https://github.com/web-platform-tests/wpt/blob/fe43457ae07199d52561d26b6a7f0d461d92d8c8/css/css-variables/variable-definition.html#L86) for that on WPT. So this similar to `CSSKeyframesRule.name` then, which is inconsistent with `CSSKeyframesRule.name` by the way: browsers parse its input as a CSS value, against `<counter-style-name>`.

Is it normal that this is not clearly specified? Eg. with "when `name` is a custom property name, replace `name` with `CSS.escape(name)`.

Now this does not prevent trimming whitespaces and comments. There is no benefit, except consistency:

```js
style.setProperty(' /**/ color /**/ ', 'green') // invalid
style.cssText = ' /**/ color /**/ : green' // valid
style.setProperty('color', ' /**/ green /**/ ') // valid
styleSheet.insertRule(' /**/ style {} /**/ ') // valid
styleSheet.media.appendMedium(' /**/ (width: 1px) /**/ ') // valid
```

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


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

Received on Friday, 27 December 2024 20:19:34 UTC