1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
7 <title>Fill Table Hit Test
</title>
9 body { margin:
0px
0px
0px
0px; }
11 <script language=
"JavaScript" type=
"text/javascript">
17 if (window
.testRunner
) {
18 testRunner
.dumpAsText();
19 window
.testRunner
.waitUntilDone();
22 function cellHit(cell
) {
23 var cellId
= 24 * cell
.parentNode
.rowIndex
+ cell
.cellIndex
;
27 function doTest(cellwidth
) {
28 var ypos
= cellHeight
;
29 for (var row
= 0; row
< 24; row
++) {
31 for (var col
= 0; col
< 19; col
++) {
32 var cellId
= 24 * row
+ col
;
33 logMsg
+= "Attempting to hit cell at row: " + row
+ ", column: " + col
+ ": ";
34 var elem
= document
.elementFromPoint(xpos
, ypos
);
35 if (elem
) elem
.onmousemove();
36 var success
= lastSuccess
== cellId
;
37 if (!success
) failed
= true;
38 logMsg
+= (success
? "SUCCESS" : "FAIL") + "<br />";
39 xpos
+= cellwidth
+ 1;
43 document
.body
.innerHTML
=(failed
? "FAIL!!!<br/>" : "SUCCESS!!!<br/>") +logMsg
;
44 if (window
.testRunner
) {
45 window
.testRunner
.notifyDone();
49 function CreateTable(tablewidth
, rowcount
, colcount
) {
50 var cellwidth
= (tablewidth
/ colcount
) - 1;
51 var tablestr
= "<table style=\"table-layout:fixed;\" border=\"1\" width=\"" +
52 tablewidth
+ "\" cellspacing=\"0\" cellpadding=\"0\">";
53 for (var row
= 0; row
< rowcount
; row
++) {
54 var rowstr
= "<tr height=\"20\">";
55 for (var col
= 0; col
< colcount
; col
++) {
56 var cellId
= "r" + row
+ "c" + col
;
57 var colstr
= "<td width=\"" + cellwidth
+ "\" id=\"" + cellId
+ "\" onmousemove=\"cellHit(this)\"></td>";
64 tablestr
+= "</table>";
65 document
.getElementById('tablebox').innerHTML
= tablestr
;
66 doTest(Math
.round(cellwidth
));
71 <body onload=
"CreateTable(500, 50, 20);" >
72 <div id=
"tablebox" style=
"overflow:hidden; width:500px; height:500px;"></div>