Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / events / input-tab-focus-no-duplicate-events.html
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
9
10 Actual:
11 </pre>
12
13 <script>
14 if (window.testRunner)
15     window.testRunner.dumpAsText();
16
17 function log(s) {
18     document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
19 }
20
21 var topInput = document.getElementById('x');
22 var topCounter = 0;
23 var bottomInput = document.getElementById('y');
24 var bottomCounter = 0;
25
26 topInput.addEventListener('focus', function() {
27     ++topCounter;
28     log("Top Input: Focus Event #" + topCounter);
29 }, false);
30
31 bottomInput.addEventListener('focus', function() {
32     ++bottomCounter;
33     log("Bottom Input: Focus Event #" + bottomCounter);
34     topInput.focus();
35 }, false);
36
37 topInput.focus();
38 if (window.eventSender)
39     eventSender.keyDown('\t');
40 </script>