Skip to content

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

@xiaochengh

Description

@xiaochengh

According to the spec, as long as the given string can be parsed into a <dimension-token>, the return value is the reification of the token. And reification 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, 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.

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