Closed
Bug 783607
Opened 13 years ago
Closed 12 years ago
Write a test to check the precision of <input type=number>
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: raphc, Assigned: mounir)
References
Details
Attachments
(1 file, 2 obsolete files)
7.32 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
Right now we use a double to hold the step attribute value.
While most of the time the double's precision is enough, there are some cases where it's not enough and it's not possible to calculate the exact value of the allowed value step (http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#concept-input-step), e.g. for an <input type=number> with:
min=0.1,
step=0.2,
value=0.3,
the element will be in the step mismatch validity step, even though it's actually in a valid state, because the double is not precise enough to handle the 0.1+0.2 addition.
The use of a double precision floating point number can lead to various edge case issues such as the one described above and, since the operations on the step/stepScaleFactor/stepBase/etc are not performance critical, we should use some arbitrary-precision type instead.
![]() |
||
Comment 1•12 years ago
|
||
Bug 853525 fixed this issue, but it only added tests for <input type=range>. We could also do with similar tests for type=number.
Summary: improve the precision of the input element step attribute. → Write a test to check the precision of <input type=number>
Assignee | ||
Comment 2•12 years ago
|
||
![]() |
||
Comment 3•12 years ago
|
||
What about test_input_range_rounding.html ?
Assignee | ||
Comment 4•12 years ago
|
||
Is that better? :)
Attachment #749234 -
Attachment is obsolete: true
Attachment #749234 -
Flags: review?(jwatt)
Attachment #749803 -
Flags: review?(jwatt)
![]() |
||
Comment 5•12 years ago
|
||
I can't be completely sure that this will pass try since there was a huge amount of churn on the range code in the six weeks between v21 and v22 uplift. Might as well get review to make sure that this is ready as soon as possible assuming Try passes.
Assignee: mounir → jwatt
Attachment #749810 -
Flags: review?(mounir)
![]() |
||
Comment 6•12 years ago
|
||
Comment on attachment 749810 [details] [diff] [review]
more realistic patch
Nice - totally just attached that to the wrong bug.
Attachment #749810 -
Attachment is obsolete: true
Attachment #749810 -
Flags: review?(mounir)
![]() |
||
Updated•12 years ago
|
Assignee: jwatt → mounir
![]() |
||
Comment 7•12 years ago
|
||
Comment on attachment 749803 [details] [diff] [review]
Patch
Yes. :) Thanks!
Attachment #749803 -
Flags: review?(jwatt) → review+
Assignee | ||
Comment 8•12 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla24
Version: unspecified → Trunk
Comment 9•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•