<input type=range> default value doesn't conform to the specification if min > max |
|||
Issue descriptionChrome Version: 59 canary OS: all Firefox: OK Safari: NG What steps will reproduce the problem? (1) Open http://w3c-test.org/html/semantics/forms/the-input-element/range.html What is the expected result? 14th test should pass. "default value when both min and max attributes are given, while min > max" What happens instead? 14th test fails. Please use labels and text to provide additional information. The minimum reproducible URL is: data:text/html,<input type="range" min=2 max=-3 /><script>alert(document.querySelector('input').value);</script> https://html.spec.whatwg.org/multipage/forms.html#concept-input-value-default-range > The default value is the minimum plus half the difference between the minimum and the maximum, unless the maximum is less than the minimum, in which case the default value is the minimum. It seems our implementation just ignores the max value in such case. This is an issue of RangeInputType::sanitizeValue() and StepRange::defaultValue().
,
Mar 13 2017
https://codereview.chromium.org/2742243002 Please check if this meets your standards. I'll be happy to make the necessary changes.
,
Mar 13 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d9f7bd34b3431faf6ce077fc1d85b2335a722931 commit d9f7bd34b3431faf6ce077fc1d85b2335a722931 Author: martin <martin@martinrogalla.com> Date: Mon Mar 13 05:35:56 2017 input[type=range]: if min > max use min as default value. This patch ensures that if the maximum attr of an <input type="range"> is less than the minimum attr, the minimum attr value is used as the default value. This is according to the specification in [1]. This patch fixes the 14th test in [2]. [1] - https://html.spec.whatwg.org/multipage/forms.html#concept-input-value-default-range [2] - http://w3c-test.org/html/semantics/forms/the-input-element/range.html BUG= 699419 Review-Url: https://codereview.chromium.org/2742243002 Cr-Commit-Position: refs/heads/master@{#456327} [modify] https://crrev.com/d9f7bd34b3431faf6ce077fc1d85b2335a722931/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range-expected.txt [modify] https://crrev.com/d9f7bd34b3431faf6ce077fc1d85b2335a722931/third_party/WebKit/Source/core/html/forms/RangeInputType.cpp
,
Mar 13 2017
,
Mar 13 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by tkent@chromium.org
, Mar 8 2017