[css-houdini-drafts] [css-typed-om] `StylePropertyMap.set()` and `.append()` don't reject string `var()` references (#1157)

AtkinsSJ has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-typed-om] `StylePropertyMap.set()` and `.append()` don't reject string `var()` references ==
Step 5 says of `set()` [says:](https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set)

> If the [size](https://infra.spec.whatwg.org/#list-size) of values is two or more, and one or more of the [items](https://infra.spec.whatwg.org/#list-item) are a [CSSUnparsedValue](https://drafts.css-houdini.org/css-typed-om-1/#cssunparsedvalue) or [CSSVariableReferenceValue](https://drafts.css-houdini.org/css-typed-om-1/#cssvariablereferencevalue) object, [throw](https://webidl.spec.whatwg.org/#dfn-throw) a [TypeError](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-native-error-types-used-in-this-standard-typeerror).

`values` is a list of `(CSSStyleValue or USVString)`. The spec only asks us to check if one of the values is a kind of `CSSStyleValue` object, but we also need to reject `USVString`s that would represent one. This behaviour is tested in WPT and Blink/WebKit both pass it: https://wpt.fyi/results/css/css-typed-om/the-stylepropertymap/declared/set.tentative.html (Specifically the "Setting a list-valued property with a var ref() and other values throws TypeError" subtest.)

It's only in step 9 that we "[create an internal representation](https://drafts.css-houdini.org/css-typed-om-1/#create-an-internal-representation)", which includes converting strings to `CSSStyleValue`s. Doing this earlier is one solution.

(Related, "create an internal representation" parses a string into a `CSSStyleValue`, but is missing the step of converting that into an internal representation.)

The same applies to `append()`.

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


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

Received on Friday, 3 October 2025 11:02:54 UTC