[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / input-focus-no-duplicate-events.html
1 <p>Focusing on 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 Bottom Input: Focus Event #1
7 Top Input: Focus Event #1
8
9 Actual:
10 </pre>
11
12 <script>
13 if (window.layoutTestController)
14     window.layoutTestController.dumpAsText();
15
16 function log(s) {
17     document.getElementById('log').appendChild(document.createTextNode(s+"\n"));
18 }
19
20 var topInput = document.getElementById('x');
21 var topCounter = 0;
22 var bottomInput = document.getElementById('y');
23 var bottomCounter = 0;
24
25 topInput.addEventListener('focus', function() {
26     ++topCounter;
27     log("Top Input: Focus Event #" + topCounter);
28 }, false);
29
30 bottomInput.addEventListener('focus', function() {
31     ++bottomCounter;
32     log("Bottom Input: Focus Event #" + bottomCounter);
33     topInput.focus();
34 }, false);
35
36 bottomInput.focus();
37 </script>