4 https://bugzilla.mozilla.org/show_bug.cgi?id=1339758
8 <title>Test for Bug
1339758</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
12 <script type=
"application/javascript">
14 /** Test for Bug
1339758 **/
15 var expectNonZeroCoordinates = false;
16 SimpleTest.waitForExplicitFinish();
18 function testCoordinates(e) {
19 var coordinateProperties =
32 for (var i in coordinateProperties) {
33 if (e[coordinateProperties[i]] !=
0) {
34 ok(expectNonZeroCoordinates, e.target.id +
" got at least some non-zero coordinate property: " + i);
38 ok(!expectNonZeroCoordinates,
"Non-zero coordinates weren't expected");
42 info(
"Testing click events which should have only 0 coordinates.");
43 document.getElementById(
"div_target").click();
44 document.getElementById(
"a_target").focus();
46 document.getElementById(
"input_target").focus();
49 info(
"Testing click events which should have also non-zero coordinates.");
50 expectNonZeroCoordinates = true;
51 // Test script created MouseEvents
52 sendMouseEvent({ type:
"click"}, document.getElementById(
"a_target"));
53 sendMouseEvent({ type:
"click"}, document.getElementById(
"input_target"));
55 // Test widget level mouse events
56 synthesizeMouse(document.getElementById(
"a_target"),
2,
2, {});
57 synthesizeMouse(document.getElementById(
"input_target"),
2,
2, {});
61 SimpleTest.waitForFocus(runTests);
67 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1339758">Mozilla Bug
1339758</a>
70 <div id=
"div_target" onclick=
"testCoordinates(event)"> </div>
71 <a href=
"#" id=
"a_target" onclick=
"testCoordinates(event);">test link
</a><br>
72 <input type=
"button" id=
"input_target" onclick=
"testCoordinates(event);" value=
"test button">
74 <div id=
"content" style=
"display: none">