OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>HTMLTableCellElement.cellIndex</title> |
| 4 <script src="../../../../../../resources/testharness.js"></script> |
| 5 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 6 <div id="log"></div> |
| 7 <script> |
| 8 test(function() { |
| 9 var th = document.createElement("th"); |
| 10 assert_true("cellIndex" in th, '"cellIndex" in th'); |
| 11 var td = document.createElement("td"); |
| 12 assert_true("cellIndex" in td, '"cellIndex" in td'); |
| 13 }, "cellIndex should exist.") |
| 14 test(function() { |
| 15 var th = document.createElement("th"); |
| 16 assert_equals(th.cellIndex, -1); |
| 17 var td = document.createElement("td"); |
| 18 assert_equals(td.cellIndex, -1); |
| 19 }, "For cells without a parent, cellIndex should be -1.") |
| 20 test(function() { |
| 21 var table = document.createElement("table"); |
| 22 var th = table.appendChild(document.createElement("th")); |
| 23 assert_equals(th.cellIndex, -1); |
| 24 var td = table.appendChild(document.createElement("td")); |
| 25 assert_equals(td.cellIndex, -1); |
| 26 }, "For cells whose parent is not a tr, cellIndex should be -1.") |
| 27 test(function() { |
| 28 var tr = document.createElementNS("", "tr"); |
| 29 var th = tr.appendChild(document.createElement("th")); |
| 30 assert_equals(th.cellIndex, -1); |
| 31 var td = tr.appendChild(document.createElement("td")); |
| 32 assert_equals(td.cellIndex, -1); |
| 33 }, "For cells whose parent is not a HTML tr, cellIndex should be -1.") |
| 34 test(function() { |
| 35 var tr = document.createElement("tr"); |
| 36 var th = tr.appendChild(document.createElement("th")); |
| 37 assert_equals(th.cellIndex, 0); |
| 38 var td = tr.appendChild(document.createElement("td")); |
| 39 assert_equals(td.cellIndex, 1); |
| 40 }, "For cells whose parent is a tr, cellIndex should be the index.") |
| 41 </script> |
OLD | NEW |