• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1description('Test behavior of the HTMLTableRowElement cells attribute in cases where there is unusual nesting.');
2
3function checkCellNesting(tag)
4{
5    var row = document.createElement("tr");
6    var container = document.createElement(tag);
7    var cell = document.createElement("td");
8    row.appendChild(container);
9    container.appendChild(cell);
10    return row.cells.length;
11}
12
13function checkHeaderCellNesting(tag)
14{
15    var row = document.createElement("tr");
16    var container = document.createElement(tag);
17    var cell = document.createElement("th");
18    row.appendChild(container);
19    container.appendChild(cell);
20    return row.cells.length;
21}
22
23var tags = [
24    "col",
25    "colgroup",
26    "div",
27    "form",
28    "script",
29    "table",
30    "tbody",
31    "tfoot",
32    "thead",
33    "tr",
34];
35
36for (i = 0; i < tags.length; ++i)
37    shouldBe('checkCellNesting("' + tags[i] + '")', '0');
38
39debug('');
40
41shouldBe('checkCellNesting("td")', '1');
42shouldBe('checkCellNesting("th")', '1');
43
44debug('');
45
46for (i = 0; i < tags.length; ++i)
47    shouldBe('checkHeaderCellNesting("' + tags[i] + '")', '0');
48
49debug('');
50
51shouldBe('checkHeaderCellNesting("td")', '1');
52shouldBe('checkHeaderCellNesting("th")', '1');
53
54debug('');
55
56var successfullyParsed = true;
57