[csswg-drafts] [css-color-4] Specified value for color when calc() is used (#8318)

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

== [css-color-4] Specified value for color when calc() is used ==
With the addition of more specificity for the specified value of colors that just went in (thanks @svgeesus!), one thing that I would like to be explicitly specified is whether calc() should be preserved through specified value serialization.

For example, take:

```css
    let test = document.createElement("div")
    test.style.color = "rgb(calc(100), 255, 255)"

    console.log(test.style.color)
```

In Safari and Firefox (I have not tested anything else), this logs `rgb(100, 255, 255)`, seemingly resolving the calc(). (See https://bug-250325-attachments.webkit.org/attachment.cgi?id=464424 for a live test case). This is inconsistent with other properties (like say, `width`), and the way `calc()` is specified (see https://github.com/w3c/csswg-drafts/issues/8290#issuecomment-1376217176).

My proposal would be to have colors match other properties and perverse the minimal calc(). So, for the example above, I would expect the right serialization to be `rgb(calc(100), 255, 255)`.

I can see some argument that legacy colors have had this behavior long enough and the required conversions from hsl() to rgb() would make the rules inconsistent in some places, so, as an alternative to always requiring preservation, I think requiring it for all non-legacy colors would be a good option as well.

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


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

Received on Monday, 16 January 2023 17:37:54 UTC