3 <script src=
"../../resources/js-test.js"></script>
6 <p id=
"description"></p>
7 <input id=
"input1" type=
"text"></input>
8 <input id=
"input2" type=
"text"></input>
9 <input id=
"input3" type=
"text"></input>
13 description("Checks that the relatedTarget attribute for FocusEvent objects is being set correctly when focusin/focusout events are dispatched. <b>Press tab four times</b> to dispatch a focusin and focusout event for each of the inputs below.");
15 var input1
= document
.getElementById('input1');
16 var input2
= document
.getElementById('input2');
17 var input3
= document
.getElementById('input3');
19 input1
.addEventListener("focusin", function(event
) { shouldBeNull('event.relatedTarget'); });
20 input1
.addEventListener("focusout", function(event
) { shouldBe('event.relatedTarget', 'input2'); });
21 input1
.addEventListener("focus", function(event
) { shouldBeNull('event.relatedTarget'); });
22 input1
.addEventListener("blur", function(event
) { shouldBe('event.relatedTarget', 'input2'); });
23 input2
.addEventListener("focusin", function(event
) { shouldBe('event.relatedTarget', 'input1'); });
24 input2
.addEventListener("focusout", function(event
) { shouldBe('event.relatedTarget', 'input3'); });
25 input2
.addEventListener("focus", function(event
) { shouldBe('event.relatedTarget', 'input1'); });
26 input2
.addEventListener("blur", function(event
) { shouldBe('event.relatedTarget', 'input3'); finishJSTest(); });
29 for (var i
= 0; i
< 2; i
++) {
30 eventSender
.keyDown('\t');