Description
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:
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 #8290 (comment)).
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.