4 <script src=
"../../resources/js-test.js"></script>
8 description('Testcase for bug <a href="http://webkit.org/b/93738">http://webkit.org/b/93738 </a>. \
9 The testcase checks if the cellIndex of a table cell(td/th) is correct when the cell is inside different parents.');
11 debug('The cellIndex of a table cell (td/th) must be -1 if its parent is other than a table row. Otherwise \
12 the cellIndex must be a value greater than or equal to 0.');
14 th_with_no_parent
= document
.createElement("th");
15 shouldBe('th_with_no_parent.cellIndex', '-1');
16 td_with_no_parent
= document
.createElement("td");
17 shouldBe('td_with_no_parent.cellIndex', '-1');
19 table
= document
.createElement("table");
20 th_with_table_parent
= table
.appendChild(document
.createElement("th"));
21 shouldBe('th_with_table_parent.cellIndex', '-1');
22 td_with_table_parent
= table
.appendChild(document
.createElement("td"));
23 shouldBe('td_with_table_parent.cellIndex', '-1');
25 thead
= document
.createElement("thead");
26 th_with_thead_parent
= thead
.appendChild(document
.createElement("th"));
27 shouldBe('th_with_thead_parent.cellIndex', '-1');
28 td_with_thead_parent
= thead
.appendChild(document
.createElement("td"));
29 shouldBe('td_with_thead_parent.cellIndex', '-1');
31 tbody
= document
.createElement("tbody");
32 th_with_tbody_parent
= tbody
.appendChild(document
.createElement("th"));
33 shouldBe('th_with_tbody_parent.cellIndex', '-1');
34 td_with_tbody_parent
= tbody
.appendChild(document
.createElement("td"));
35 shouldBe('td_with_tbody_parent.cellIndex', '-1');
37 tfoot
= document
.createElement("tfoot");
38 th_with_tfoot_parent
= tfoot
.appendChild(document
.createElement("th"));
39 shouldBe('th_with_tfoot_parent.cellIndex', '-1');
40 td_with_tfoot_parent
= tfoot
.appendChild(document
.createElement("td"));
41 shouldBe('td_with_table_parent.cellIndex', '-1');
43 tr
= document
.createElement("tr");
44 first_cell_th_with_tr_parent
= tr
.appendChild(document
.createElement("th"));
45 shouldBe('first_cell_th_with_tr_parent.cellIndex', '0');
46 second_cell_td_with_tr_parent
= tr
.appendChild(document
.createElement("td"));
47 shouldBe('second_cell_td_with_tr_parent.cellIndex', '1');