Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Bug in Number Input #975

Closed
jthiyagarajan opened this issue Jul 26, 2017 · 4 comments
Closed

Bug in Number Input #975

jthiyagarajan opened this issue Jul 26, 2017 · 4 comments

Comments

@jthiyagarajan
Copy link

Consider the below html input type "number"

Since, its a number type it will allow you to type number only, but if you type any alpha,special character it will not allow you enter.

But i found that letter "e" is allowed in the type .

Please clarify.

@LJWatson
Copy link
Collaborator

Thanks @jthiyagarajan

The definition of <input type="number"> explains that only valid floating-point numbers should be accepted.

That said, it seems that browsers do not always honour this requirement though.

It seems that browsers may not consistently recognise this requirement though. With thanks to @IanPouncey for tests, it seems that Safari and Firefox accept any non-numeric character, whilst Chrome accepts "e" but no other non-numeric character.

I think this issue seems to be with the browsers, not the HTML specification, though perhaps the definition could be improved?

@IanPouncey
Copy link

To be clear, Chrome accepts 'e' (or 'E') as exponent shorthand (i.e. 3e5 for 3×10^5), not as a constant. It validates the former if it is in range, but not the latter as a number.

@chaals
Copy link
Collaborator

chaals commented Dec 18, 2017

@IanPouncey did your tests show that browsers other than chrome accept the 3.0e8 notation as valid for number?

@chaals
Copy link
Collaborator

chaals commented Jun 19, 2018

This is covered by #1355 - closing as a duplicate

@chaals chaals closed this as completed Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants