Re: [csswg-drafts] [css-typed-om] Should throw TypeError when CSSTransformComponents attributes are set to values that does not match (#12388)

Upon further inspection it seems like there's a bug in the test. 
It seems to read the wrong property from `gInvalidCoordTestCases`. (It reads `value`, while it probably should read `coord`)
As a result, it tries to set the attributes to `undefined`. In this scenario, both Safari and Chrome throws a TypeError.

```js
const t = new CSSTranslate(CSS.px(1), CSS.px(1));
t.x = undefined;
// Throws in Chrome and Safari:
// TypeError: The CSSTranslate.x attribute must be an instance of CSSNumericValue
```

Chrome also throws a TypeError if `x` is set to a CSSNumericValue that is not `<length>` or `<percent>`, as I think was the intention of the test.

```js
const t = new CSSTranslate(CSS.px(1), CSS.px(1));
t.x = CSS.deg(5);
// Throws in Chrome
// Uncaught TypeError: Failed to set the 'x' property on 'CSSTranslate': Must pass length or percentage to X of CSSTranslate
```

Both browsers seem to verify the value when it is assigned, but they use slightly different rules.

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


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

Received on Tuesday, 24 June 2025 06:03:54 UTC