5 <script src=
"../../resources/js-test.js"></script>
9 description("This test documents the behavior of MouseEvent.offsetX/Y in response to HTMLElement.click().");
11 var testDiv
= document
.createElement("div");
12 testDiv
.setAttribute("style", "background: green; width: 100px; height: 100px; position: absolute; top: 100px; left: 100px;");
13 document
.body
.appendChild(testDiv
);
15 testDiv
.addEventListener("click", function(e
) {
17 shouldBe("event.offsetX", expectedX
);
18 shouldBe("event.offsetY", expectedY
);
21 debug("Simulated click with .click():");
26 if (!window
.eventSender
)
27 debug("This part of the test requires eventSender!");
29 debug("Click with mouse at 0,0:");
32 eventSender
.mouseMoveTo(100, 100);
33 eventSender
.mouseDown();
34 eventSender
.mouseUp();
36 debug("Click with mouse at 40,50:");
39 eventSender
.mouseMoveTo(140, 150);
40 eventSender
.mouseDown();
41 eventSender
.mouseUp();