[Webkit-unassigned] [Bug 64786] The value of a number input form continues to increase/decrease even if we disable the input form.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jul 20 02:20:06 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=64786
--- Comment #21 from Kentaro Hara <haraken at google.com> 2011-07-20 02:20:06 PST ---
> Ok, let's keep your test code as is. The test might have flaky timeouts in buildbots because of the slowness. If it happened, I would remove the test.
Thanks.
> > Sorry but I am confused... Why can we shorten the time by using setTimeout() in the 'input' event?
>
> I was confused with your test scenario and the original scenario in crbug.com/74960. In the original scenario, the input was disabled in 'input' handler. I'm sorry for the confusion.
It is possible to write a test with the 'input' event, but I am using the 'mouseup' event instead of the 'input' event, because it would be a simpler way to test the change that we made in this patch.
Please assume the following script:
<input type="number" id="input" oninput="inputEventDispatched()" />
<script>
var input = $("input");
var testDelays = [1, 10, 100];
...;
function nextDelayTest() {
delay = testDelays.shift();
initializeInputAttributes(input, 1234567);
clickSpinDownButton(input);
setTimeout(function() {
shouldBeEqualToString('input.value', "1234566");
nextDelayTest();
}, 500);
}
function inputEventDispatched() {
input.readOnly = true;
setTimeout(function() {
input.readOnly = false;
}, delay);
}
</script>
For the previous WebKit code (without my patch), the above script will not work as we expect. This is because |input| is a global variable. In the previous WebKit code, the repeating timer is fired again and again, and the 'input' event is triggered whenever the repeating timer is fired and the number is changed. Thus, even if we move on to the next delay test, inputEventDispatched() of the previous delay test still continues to be invoked, which unintentionally changes |input.readOnly| for the current delay test. To prevent this, we need to prepare an input form and the variable to refer to the input form for each delay test and for each readonly/disabled test, which would make the script messy. (Or we need to add or remove event handlers for the 'input' event appropriately.)
On the other hand, in case of the 'mouseup' event, the above problem does not happen since the 'mouseup' event is not triggered when the repeating timer is fired.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list