Re: [csswg-drafts] [css-values-4] What should non-calc() math functions serialize to when they're fully resolved? (#4399)

> RESOLVED: If numeric simplification of a math function results in a single value, the serialization is that value wrapped in `calc()`

```js
element.style.borderRadius = 'calc(1px) 1px'
console.log(element.style.borderRadius) // "calc(1px) 1px"
element.style.color = 'rgb(calc(256) 0 0 / calc(2))'
console.log(element.style.color) // "rgb(255, 0, 0)"
element.style.backgroundImage = 'linear-gradient(calc(180deg), red, cyan)'
console.log(element.style.backgroundImage) // "linear-gradient(red, cyan)"
```

The output annotated as comments above are for Chrome and Firefox.

Could you please tell me what are the cases that require wrapping the value in `calc()`? Amelia was mentionning cases with negative values but I can not figure out what could be the problem with negative values.

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


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

Received on Monday, 20 June 2022 13:41:07 UTC