5 window
.onfocus
= windowFocused
;
6 window
.onblur
= windowBlurred
;
8 if (window
.testRunner
) {
9 window
.testRunner
.dumpAsText();
10 window
.testRunner
.setMainFrameIsFirstResponder(true);
12 window
.testRunner
.setWindowIsKey(false);
13 window
.testRunner
.setWindowIsKey(true);
14 window
.testRunner
.setWindowIsKey(false);
18 function log(message
) {
19 var console
= document
.getElementById("console");
20 var li
= document
.createElement("li");
21 var text
= document
.createTextNode(message
);
23 console
.appendChild(li
);
27 function windowFocused() {
28 log("Window was focused");
31 function windowBlurred() {
32 log("Window was blurred");
36 This tests window.onFocus and window.onBlur handlers. It uses the testRunners ability to mimic bringing the window to the front and pushing it to the back.
37 <p><b>It is not intended to be run interactively:
</b> when you run it interactively, you should see 'Window was blurred' and 'Window was focused' messages as you push the window to the back and bring it to the front, respectively.
</p>
38 <ul id=
"console"></ul>
39 <script>runTest();</script>