[csswg-drafts] [cssom-1][css-values-4][css-cascade-5] When should calc() be maintained in specified value serialization? (#8290)

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

== [cssom-1][css-values-4][css-cascade-5] When should calc() be maintained in specified value serialization? ==
I am trying to determine if there is there a universal rule for when `calc()` should be maintained when serializing specified values? 

For example, consider the following:

```javascript
    let test = document.createElement("div")
    test.style.width = "calc(100px)"

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

In both Safari and Firefox (I have not tested anything else so far), this logs "calc(100px)". (If you were to go and add the element to the DOM and query the computed style, you would get "100px"). So for this property / value at least, calc() seems to be maintained in the specified value serialization.

However, if you take:

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

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

this logs "rgb(100, 255, 255)", seemingly resolving the calc(). 

It's possible this is clearly defined somewhere, or perhaps it is up to each individual property and/or value to define, but I have been having trouble finding it.

https://drafts.csswg.org/cssom/#serialize-a-css-component-value makes mention of differentiating between specified and computed / resolved values (calling it out as an issue), but its not clear that CSSOM would be the right spec for defining rules for calc() (though perhaps it would).

(See https://bug-250325-attachments.webkit.org/attachment.cgi?id=464424 for a live testcase)

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


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

Received on Monday, 9 January 2023 17:23:03 UTC