Skip to content
Permalink
Browse files

Update UI when changing input's value with setAttribute

This patch fixes a bug where setting a range input element's default
value with setAttribute('value', defaultValue) does not update the UI of
the range input to show the new default value.
The bug is present in WebKit, but not present in Firefox.

Bug: 852938
Change-Id: Ibef8c0c6cefeb221a0d9220a966b04a03d815c76
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Oct 10, 2019
1 parent 2e76810 commit ec9b923379a5cb5ee25b4eb04aeb4eaee65a2551
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>range input element setAttribute value appearance</title>

<p>Test passes if the range element below visually has its slider at 2/10 from the left</p>

<input type=range min=0 max=10 value=2></input>
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/input.html#the-input-element">
<link rel="match" href="range-setattribute-value-ref.html">
<title>range input element setAttribute value appearance</title>

<p>Test passes if the range element below visually has its slider at 2/10 from the left</p>

<script>
window.onload = () => {
const input = document.createElement('input');
input.type = 'range';
input.min = 0;
input.max = 10;
document.body.appendChild(input);
requestAnimationFrame(() => {
requestAnimationFrame(() => {
input.setAttribute('value', 2);
document.documentElement.classList.remove('reftest-wait');
});
});
};
</script>

0 comments on commit ec9b923

Please sign in to comment.
You can’t perform that action at this time.