6 document
.getElementById('output').innerHTML
+= string
;
9 function mouseDown(evt
)
11 log("<span style='color:green'>[Mouse Down]</span> Button: " + evt
.button
+ " Click Count: " + evt
.detail
+ "<br>");
16 log("<span style='color:green'>[Mouse Up]</span> Button: " + evt
.button
+ " Click Count: " + evt
.detail
+ "<br>");
19 function mouseClick(evt
)
21 log("<span style='color:green'>[Mouse Click]</span> Button: " + evt
.button
+ " Click Count: " + evt
.detail
+ "<br>");
24 function mouseDoubleClick(evt
)
26 log("<span style='color:green'>[Mouse Double Click]</span> Button: " + evt
.button
+ " Click Count: " + evt
.detail
+ "<br>");
31 if (window
.testRunner
) {
32 testRunner
.dumpAsText();
33 testRunner
.waitUntilDone();
35 if (window
.eventSender
) {
36 var testEle
= document
.getElementById("testDiv");
37 eventSender
.mouseMoveTo(testEle
.offsetLeft
+testEle
.offsetWidth
/2, testEle.offsetTop+testEle.offsetHeight/2);
44 for (var clickCount
= 1; clickCount
<= 5; clickCount
++) {
45 log("Clicking " + clickCount
+ " times<br>");
46 for (var click
= 0; click
< clickCount
; click
++) {
47 eventSender
.mouseDown();
48 eventSender
.mouseUp();
50 // Skip forward 1 second so that the clicks are counted as distinct.
51 eventSender
.leapForward(1000);
53 testRunner
.notifyDone();
58 <body onload=
"test()">
59 <div id=
"testDiv" style=
"-webkit-user-select: none; border:1px solid red" onmousedown=
"mouseDown(event)" onmouseup=
"mouseUp(event)" onclick=
"mouseClick(event)" ondblclick=
"mouseDoubleClick(event)">Click inside this div
</div>