Add a script to run ImageDiff manually
[WebKit-https.git] / LayoutTests / fast / events / mouseenter-mouseleave.html
1 <!DOCTYPE html>
2 <html id=html>
3 <head>
4 <script>
5 function log(message, console) {
6     document.getElementById('console').innerHTML += (message + "\n");
7 }
8
9 function logMouseEvent(ev) {
10     var target = (ev.target)? ev.target : ev.srcElement;
11     log(ev.type + " on " + target.id);
12     event.stopPropagation();
13 }
14
15 function doTest() {
16     document.body.offsetLeft;
17     if (window.testRunner) {
18         log("mouseMoveTo(1, 1)");
19         eventSender.mouseMoveTo(1, 1);
20         log("<br>mouseMoveTo(90,140)");
21         eventSender.mouseMoveTo(90,140);
22         log("<br>mouseMoveTo(110,140)");
23         eventSender.mouseMoveTo(110,140);
24         log("<br>mouseMoveTo(130,140)");
25         eventSender.mouseMoveTo(130,140);
26         log("<br>mouseMoveTo(170,140)");
27         eventSender.mouseMoveTo(170,140);
28         log("<br>mouseMoveTo(180,140)");
29         eventSender.mouseMoveTo(180,140);
30         log("<br>mouseMoveTo(210,140)");
31         eventSender.mouseMoveTo(210,140);
32
33         testRunner.dumpAsText();
34     }
35 }
36
37 document.addEventListener("DOMContentLoaded", function(event) {
38     var mouseTargets = document.querySelectorAll('[id]');
39     for (var i = 0; i < mouseTargets.length; ++i) {
40         var target = mouseTargets[i];
41         target.addEventListener('mouseover', logMouseEvent);
42         target.addEventListener('mouseenter', logMouseEvent);
43         target.addEventListener('mouseout', logMouseEvent);
44         target.addEventListener('mouseleave', logMouseEvent);
45         target.addEventListener('mousemove', logMouseEvent);
46     }
47     doTest();
48 });
49 </script>
50 </head>
51 <body id='body'>
52 <div id="outer1" style="width:100px; height:100px; background-color:blue; top:100px; left:100px; position:absolute">
53   <div id="inner1" style="width:50px; height:50px; background-color:red; top:20px; left:20px; position:absolute">
54   </div>
55   <div id="inner2" style="width:20px; height:20px; background-color:yellow; top:30px; left:60px; position:absolute">
56     <div id="inner3" style="margin:5px; width:10px; height:10px; background-color:green;">
57     </div>
58   </div>
59 </div>
60
61 <pre id="console"></pre>
62 </body>
63 </html>