4 function print(message
, color
) {
5 var paragraph
= document
.createElement("div");
6 paragraph
.appendChild(document
.createTextNode(message
));
7 paragraph
.style
.fontFamily
= "monospace";
9 paragraph
.style
.color
= color
;
10 document
.getElementById("console").appendChild(paragraph
);
12 function shouldBe(description
, actual
, expected
)
14 if (expected
=== actual
) {
15 print("PASS: " + description
+ " should be " + expected
+
19 print("FAIL: " + description
+ " should be " + expected
+
20 " but instead is " + actual
+ "\n",
24 function mouseeventverify(event
, x
, y
, offsetX
, offsetY
, target
, type
)
26 shouldBe("event type", event
.type
, type
);
27 shouldBe("event target", event
.target
, target
);
28 shouldBe("event.pageX", event
.pageX
, x
);
29 shouldBe("event.pageY", event
.pageY
, y
);
30 shouldBe("event.offsetX", event
.offsetX
, offsetX
);
31 shouldBe("event.offsetY", event
.offsetY
, offsetY
);
32 shouldBe("event.x", event
.x
, x
);
33 shouldBe("event.y", event
.y
, y
);
36 if (window
.testRunner
) {
37 testRunner
.dumpAsText();
38 testRunner
.waitUntilDone();
41 if (window
.eventSender
) {
42 eventSender
.mouseMoveTo(22, 104);
43 eventSender
.mouseDown();
44 eventSender
.mouseUp();
47 if (window
.eventSender
) {
48 eventSender
.mouseMoveTo(22, 184);
49 eventSender
.mouseDown();
50 eventSender
.mouseUp();
53 if (window
.eventSender
) {
54 eventSender
.mouseMoveTo(22, 262);
55 eventSender
.mouseDown();
56 eventSender
.mouseUp();
59 if (window
.eventSender
) {
60 eventSender
.mouseMoveTo(22, 344);
61 eventSender
.mouseDown();
62 eventSender
.mouseUp();
63 eventSender
.mouseDown();
64 eventSender
.mouseUp();
67 if (window
.eventSender
) {
68 eventSender
.mouseMoveTo(22, 448);
69 eventSender
.mouseDown();
70 eventSender
.mouseUp();
71 eventSender
.mouseDown();
72 eventSender
.mouseUp();
75 if (window
.testRunner
)
76 testRunner
.notifyDone();
80 <body onload=
"test();">
81 <p>This page tests whether a click event on a list box item propogates with the correct target and positioning values.
<br>
82 Bug
3248: Mouse events on OPTION element seem to be ignored
<br>
83 <a href=
"https://bugs.webkit.org/show_bug.cgi?id=3248">https://bugs.webkit.org/show_bug.cgi?id=
3248</a></p>
84 <form action=
"" method=
"post">
85 <select style=
"position:absolute; top: 84;" size=
"2" onmousedown=
"mouseeventverify(event, 22, 104, 13, 5, document.getElementById('o1'), 'mousedown')">
87 <option id=
"o1" onmousedown=
"mouseeventverify(event, 22, 104, 13, 5, this, 'mousedown')">Two
90 <form action=
"" method=
"post">
91 <select style=
"position:absolute; top: 164;" size=
"2" onmouseup=
"mouseeventverify(event, 22, 184, 13, 5, document.getElementById('o2'), 'mouseup')">
93 <option id=
"o2" onmouseup=
"mouseeventverify(event, 22, 184, 13, 5, this, 'mouseup')">Two
96 <form action=
"" method=
"post">
97 <select style=
"position:absolute; top: 242;" size=
"2" onclick=
"mouseeventverify(event, 22, 262, 13, 5, document.getElementById('o3'), 'click')">
99 <option id=
"o3" onclick=
"mouseeventverify(event, 22, 262, 13, 5, this, 'click')">Two
102 <form action=
"" method=
"post">
103 <select style=
"position:absolute; top: 324;" size=
"2" ondblclick=
"mouseeventverify(event, 22, 344, 13, 5, document.getElementById('o4'), 'dblclick')">
105 <option id=
"o4" ondblclick=
"mouseeventverify(event, 22, 344, 13, 5, this, 'dblclick')">Two
108 <select style=
"position:absolute; top: 408;" size=
"3" onmousedown=
"mouseeventverify(event, 22, 448, 12, 38, this, 'mousedown')">
110 <option id=
"o5" onmousedown=
"mouseeventverify(event, 22, 448, 12, 38, this, 'mousedown')">Two
113 <div style=
"position:absolute; top: 550;" id='console'
></div>