Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / focusinout.html
blob87eac54dd5b56d59b2de2a7fbc63161a3263b9de
1 <html onfocusin="writePass('result5')" onfocusout="writePass('result6')">
2 <head>
3 <script>
4 if (window.testRunner)
5 window.testRunner.dumpAsText();
7 function writePass(id)
9 document.getElementById(id).innerHTML = "PASS";
12 function writeFailed(id, reason)
14 document.getElementById(id).innerHTML = "FAIL: " + reason;
17 function focusHandler(event)
19 if (event.type == "focusin")
20 writePass('result1');
21 else
22 writeFailed('result1', "Wrong event type");
25 function blurHandler(event)
27 if (event.type == "focusout")
28 writePass('result2');
29 else
30 writeFailed('result2', "Wrong event type");
33 function focusHandlerTwo(event)
35 if (event.type == "DOMFocusIn")
36 writePass('result3');
37 else
38 writeFailed('result3', "Wrong event type");
41 function blurHandlerTwo(event)
43 if (event.type == "DOMFocusOut")
44 writePass('result4');
45 else
46 writeFailed('result4', "Wrong event type");
48 </script>
49 </head>
50 <body onload="document.getElementById('field').focus();document.getElementById('field').blur()">
52 <form>
53 <input type=text id="field">
54 </form>
56 <div id="result1">FAIL</div>
57 <div id="result2">FAIL</div>
58 <div id="result3">FAIL</div>
59 <div id="result4">FAIL</div>
60 <div id="result5">FAIL</div>
61 <div id="result6">FAIL</div>
63 <script>
64 document.documentElement.addEventListener("focusin", focusHandler, false);
65 document.documentElement.addEventListener("focusout", blurHandler, false);
66 document.documentElement.addEventListener("DOMFocusIn", focusHandlerTwo, false);
67 document.documentElement.addEventListener("DOMFocusOut", blurHandlerTwo, false);
68 </script>