Re: [csswg-drafts] [css-color][cssom] Serialization of specified <color> values (#1004)

> So, are you asking about `el.style.color`, `getComputedStyle(el).color`, or something else?

I'm asking about *serialize a CSS value*, which means `element.style.color` (`CSSStyleDeclaration.getPropertyValue()`), `element.style.cssText`, `CSSRule.cssText`, and more.

> So I'm not sure how you conclude that the API you're querying is returning a resolved value

I proceeded by elimination. 

**Specified value** (first gut)

```js
element.style.color = 'red'
console.log(element.style.color)
foo.style.color = 'hsl(0 0% 0%)'
console.log(element.style.color)
```

The first output is `red` in Chrome/Firefox/etc, but the second output is `rgb(0, 0, 0)`, which is not my *original, author specified color value*.

**Resolving sRGB values**

> While the function names and named colors are ASCII case-insensitive, the specified value does not preserve any mixed casing and is treated as being all lowercase.

[Me thinking] Ok, this may be a hint that it preserves my specified keyword.

> For example, the computed value of `hsl(38.824 100% 50%)` is `rgb(255, 165, 0)`

[Me thinking] Ok, it fits.

**Computed value**

> The serialized form of the following sRGB values: hex colors rgb() and rgba() values hsl() and hsla() values hwb() values named colors is derived from the computed value and thus, uses either the rgb() or rgba() form.

[Me thinking] Does not fit because my specified keyword should not be transformed to `rgb()`.

[Me thinking] Ok, my input is a component of a resolved value. My gut was wrong.

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


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

Received on Wednesday, 9 March 2022 03:50:13 UTC