Number input value is empty when trailing dot is present
Categories
(Core :: DOM: Forms, defect)
Tracking
()
People
(Reporter: tuoris.dev, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
187 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Steps to reproduce:
- Add input with type "number"
- Add event listener for "input" event to print out input value to console
- Focus input then type: "4", ".", "2"
Actual results:
Console output on Firefox 113:
4
<empty string>
4.2
Expected results:
According to Input Number specification (https://www.w3.org/TR/2011/WD-html5-20110525/number-state.html#number-state): "If the value of the element is not a valid floating point number, then set it to the empty string instead.",
but "4." value is valid according to https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#valid-floating-point-number .
So console output on Firefox should look like this:
4
4
4.2
Chrome output for comparison:
4
4
4.2
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Example works fine on Firefox 112 and I was able to track it to https://github.com/mozilla/gecko-dev/blob/master/dom/html/HTMLInputElement.cpp#L4590
Comment 3•2 years ago
|
||
When I read step 3 in https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#valid-floating-point-number it seems to clearly say that a . must be followed by at least one digit.
- A series of one or more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
Comment 4•2 years ago
|
||
There are tests for this being disallowed that all browsers pass:
http://wpt.live/html/semantics/forms/the-input-element/number.html
Description
•