4 <script src=
"../../../resources/js-test.js"></script>
7 <p id=
"description">There was a bug that moving focus with TAB from a number input with an invalid string dispatched an extra focus event and an extra blur event.
</p>
8 <div id=
"console"></div>
10 <input type=number id=number
>
14 function handleFocus() {
18 function handleBlur() {
24 var num
= document
.getElementById('number');
25 num
.addEventListener('focus', handleFocus
);
26 num
.addEventListener('blur', handleBlur
);
28 document
.execCommand('InsertText', false, '123');
29 document
.execCommand('InsertText', false, 'a');
30 var tabEvent
= document
.createEvent('KeyboardEvent');
31 tabEvent
.initKeyboardEvent('keydown', true, true, document
.defaultView
, 'U+0009');
32 num
.dispatchEvent(tabEvent
);
34 shouldBe('numOfFocus', '1');
35 shouldBe('numOfBlur', '1');