Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / input-tab-focus-no-duplicate-events.html
blobe70f28731243148e648c28849c1128cb95e2105e
1 <p>Tabbing focus into the bottom input should not trigger duplicate focus events for both inputs.</p>
2 <input type="text" id="x"><br>
3 <input type="text" id="y">
4 <pre id="log">
5 Expected:
6 Top Input: Focus Event #1
7 Bottom Input: Focus Event #1
8 Top Input: Focus Event #2
10 Actual:
11 </pre>
13 <script>
14 if (window.testRunner)
15 window.testRunner.dumpAsText();
17 function log(s) {
18 document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
21 var topInput = document.getElementById('x');
22 var topCounter = 0;
23 var bottomInput = document.getElementById('y');
24 var bottomCounter = 0;
26 topInput.addEventListener('focus', function() {
27 ++topCounter;
28 log("Top Input: Focus Event #" + topCounter);
29 }, false);
31 bottomInput.addEventListener('focus', function() {
32 ++bottomCounter;
33 log("Bottom Input: Focus Event #" + bottomCounter);
34 topInput.focus();
35 }, false);
37 topInput.focus();
38 if (window.eventSender)
39 eventSender.keyDown('\t');
40 </script>