[css-houdini-drafts] [css-typed-om] CSSNumericValue.parse() needs type checking for `<dimension-token>` (#1064)

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

== [css-typed-om] CSSNumericValue.parse() needs type checking for `<dimension-token>` ==
According to the [spec](https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumericvalue-parse), as long as the given string can be parsed into a `<dimension-token>`, the return value is the reification of the token. And [reification](https://drafts.css-houdini.org/css-typed-om-1/#reify-a-numeric-value) doesn't have type checking, either.

So `CSSNumericValue.parse('1xyz')` should return something non-null, which doesn't make sense, and is inconsistent with the [CSSUnitValue(value, type) constructor](https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunitvalue-cssunitvalue), which throws when the type is invalid.

I think we should throw a `SyntaxError` when the unit is invalid. I'll put up a PR to fix it.

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


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

Received on Thursday, 27 January 2022 22:37:50 UTC