Skip to content

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

@AtkinsSJ

Description

@AtkinsSJ

Step 5 says of set() says:

If the size of values is two or more, and one or more of the items are a CSSUnparsedValue or CSSVariableReferenceValue object, throw a 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 USVStrings 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", which includes converting strings to CSSStyleValues. 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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions