1 <html onfocusin="writePass('result5')" onfocusout="writePass('result6')">
5 window.testRunner.dumpAsText();
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")
22 writeFailed('result1', "Wrong event type");
25 function blurHandler(event)
27 if (event.type == "focusout")
30 writeFailed('result2', "Wrong event type");
33 function focusHandlerTwo(event)
35 if (event.type == "DOMFocusIn")
38 writeFailed('result3', "Wrong event type");
41 function blurHandlerTwo(event)
43 if (event.type == "DOMFocusOut")
46 writeFailed('result4', "Wrong event type");
50 <body onload="document.getElementById('field').focus();document.getElementById('field').blur()">
53 <input type=text id="field">
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>
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);