Skip to content

Value of number type input #361

Closed
@YagamiNewLight

Description

@YagamiNewLight

I saw the way of getting value of a number type input is using "this.value".
And problems happened:
when the user enter like this "10e10",this will be OK
But when they continue to type just like this "10e10ee.12e12e12e.12e21e".Obviously,this input is not a valid number,but the "this.value" equals to the Empty string,And looks like you guys converted the string to number.So the empty string will be converted to 0. And if we set a negative min/max value,the “10e10ee.12e12e12e.12e21e” will be passed, because 0 is greater than negative value.This is not what we expect.So maybe you can use the "this.valueAsNumber".In this way,the "10e10ee.12e12e12e.12e21e" will be pasred to NaN .And we can handle the error condition more clearly .

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