4 var rectElement = document.getElementById("rect1");
5 var gElement = document.getElementById("g");
6 var useElement = document.getElementById("use");
7 var useElement2 = document.getElementById("usesymbol");
8 var switchElement = document.getElementById("switch");
9 var imgElement = document.getElementById("img");
10 description("Test whether focusin and focusout events are dispatched and seen in the focusin/focusout event handlers: ");
12 if (window.testRunner)
13 testRunner.waitUntilDone();
15 function clearFocusSeen(evt)
21 function focusinHandler(evt)
23 focusinSeen = evt.target.getAttribute('id');
26 function focusoutHandler(evt)
28 focusoutSeen = evt.target.getAttribute('id');
31 rectElement.setAttribute("onfocusin", "focusinHandler(evt)");
32 rectElement.setAttribute("onfocusout", "focusoutHandler(evt)");
33 gElement.setAttribute("onfocusin", "focusinHandler(evt)");
34 gElement.setAttribute("onfocusout", "focusoutHandler(evt)");
35 useElement.setAttribute("onfocusin", "focusinHandler(evt)");
36 useElement.setAttribute("onfocusout", "focusoutHandler(evt)");
37 useElement2.setAttribute("onfocusin", "focusinHandler(evt)");
38 useElement2.setAttribute("onfocusout", "focusoutHandler(evt)");
39 switchElement.setAttribute("onfocusin", "focusinHandler(evt)");
40 switchElement.setAttribute("onfocusout", "focusoutHandler(evt)");
41 imgElement.setAttribute("onfocusin", "focusinHandler(evt)");
42 imgElement.setAttribute("onfocusout", "focusoutHandler(evt)");
44 function clickAt(x, y)
46 eventSender.mouseMoveTo(x, y);
47 eventSender.mouseDown();
48 eventSender.mouseUp();
51 if (window.eventSender) {
53 // cause focusin and focusout
56 shouldBeEqualToString('focusinSeen', 'rect1');
57 shouldBeEqualToString('focusoutSeen', 'rect1');
61 // cause focusin and focusout
64 shouldBeEqualToString('focusinSeen', 'g');
65 shouldBeEqualToString('focusoutSeen', 'g');
69 // cause focusin and focusout
72 shouldBeEqualToString('focusinSeen', 'use');
73 shouldBeEqualToString('focusoutSeen', 'use');
77 // cause focusin and focusout
80 shouldBeEqualToString('focusinSeen', 'usesymbol');
81 shouldBeEqualToString('focusoutSeen', 'usesymbol');
85 // cause focusin and focusout
88 shouldBeEqualToString('focusinSeen', 'switch');
89 shouldBeEqualToString('focusoutSeen', 'switch');
93 // cause focusin and focusout
96 shouldBeEqualToString('focusinSeen', 'img');
97 shouldBeEqualToString('focusoutSeen', 'img');
99 successfullyParsed = true;
100 successfullyParsed = true;
102 if (window.testRunner)
103 testRunner.notifyDone();
105 alert("This test must be run via DRT!");