4 <script src=
"../../resources/js-test.js"></script>
6 window
.jsTestIsAsync
= true;
8 document
.addEventListener('DOMContentLoaded', function () {
9 listenForEvents(document
.querySelector('#outer'));
10 listenForEvents(document
.querySelector('#inner1'));
11 listenForEvents(document
.querySelector('#inner2'));
12 listenForEvents(document
.querySelector('#inner3'));
14 if (window
.testRunner
) {
15 eventSender
.mouseMoveTo(1, 1);
16 eventSender
.mouseMoveTo(90,140);
17 debug("// Entering #outer");
18 eventSender
.mouseMoveTo(110,140);
19 debug("// Entering #inner1");
20 eventSender
.mouseMoveTo(130,140);
21 debug("// Entering #inner3 (and therefore also #inner2)");
22 eventSender
.mouseMoveTo(170,140);
23 debug("// Leaving #inner3 and #inner2, but not #outer");
24 eventSender
.mouseMoveTo(180,140);
25 debug("// Leaving #outer");
26 eventSender
.mouseMoveTo(210,140);
32 function handleEvent(e
) {
33 var phases
= ['', 'capturing', 'at target', 'bubbling'];
34 var target
= e
.target
? e
.target
: e
.srcElement
;
35 if (target
.id
&& target
.id
!= "console") {
36 debug(e
.type
+ " (" + phases
[e
.eventPhase
] + ") on " + target
.id
);
37 if (e
.relatedTarget
&& e
.relatedTarget
.id
)
38 debug('- Related target: ' + e
.relatedTarget
.id
);
43 function listenForEvents(el
) {
44 ['mouseover', 'mouseout', 'mouseenter', 'mouseleave'].forEach(function(type
) {
45 el
.addEventListener(type
, handleEvent
);
79 background-color: green;
88 <div id=
"inner1"></div>
90 <div id=
"inner3"></div>