Skip to content

Extracting unit fails when value is a number #4

Description

@andrewchernow

toPx and curCss extract the unit using a regexp. However, when value is a number, this throws an exception since there is no match method on a Number object. I changed the below code from

unit = (value.match(runit)||[])[2];
to
unit = (String(value).match(runit)||[])[2];

And everything worked as expected. The code was trigger by calling window.Length(elem, '10em')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions