Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement range input sanitization #21952

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Fix a range input test

It was setting the value to " 123" without setting a maximum above.
Since the specs specifies 100 to be the default max, the value we'd get
after sanitization would be 100, not 123. This fixes it by setting the
value to something that is between the default min/max.
  • Loading branch information
Eijebong committed Oct 15, 2018
commit e3e47712cae745b3754e15da208630f3cca58357
"testharness"
],
"html/semantics/forms/the-input-element/range.html": [
"209ce25306e02986238ae26fb6fdf38b0a26a500",
"f57c520b87ea8adceb7311ef8d642db5cc5fa6b8",
"testharness"
],
"html/semantics/forms/the-input-element/required_attribute.html": [
@@ -18,6 +18,3 @@
[Performing stepDown() beyond the value of the min attribute]
expected: FAIL

[Skip ASCII whitespace within input]
expected: FAIL

@@ -34,7 +34,7 @@ <h1>Input Range</h1>
<input type="range" id="stepdown_beyond_min" min=3 max=11 value=6 step=3 />
<input type="range" id="illegal_min_and_max" min="ab" max="f" />
<input type="range" id="illegal_value_and_step" min=0 max=5 value="ppp" step="xyz" />
<input type="range" id="should_skip_whitespace" value=" 123"/>
<input type="range" id="should_skip_whitespace" value=" 98"/>

This comment has been minimized.

Copy link
@tigercosmos

tigercosmos Oct 31, 2018

Collaborator

Why use 98 rather than 123?

This comment has been minimized.

Copy link
@Eijebong

Eijebong Oct 31, 2018

Author Member

Because 123 is outside the default min-max range (0-100)

<input type="range" id="exponent_value1" value=""/>
<input type="range" id="exponent_value2" value=""/>
</div>
@@ -286,7 +286,7 @@ <h1>Input Range</h1>
test(
function() {
var e = document.getElementById('should_skip_whitespace');
assert_equals(e.value, "123")
assert_equals(e.value, "98")
}, "Skip ASCII whitespace within input", {
"help" : "https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number"
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.