summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/HTMLTableRowElement/script-tests/cells.js
blob: eb8f7c86482e39c37453b38020e13ab41cf4b2cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
description('Test behavior of the HTMLTableRowElement cells attribute in cases where there is unusual nesting.');

function checkCellNesting(tag)
{
    var row = document.createElement("tr");
    var container = document.createElement(tag);
    var cell = document.createElement("td");
    row.appendChild(container);
    container.appendChild(cell);
    return row.cells.length;
}

function checkHeaderCellNesting(tag)
{
    var row = document.createElement("tr");
    var container = document.createElement(tag);
    var cell = document.createElement("th");
    row.appendChild(container);
    container.appendChild(cell);
    return row.cells.length;
}

var tags = [
    "col",
    "colgroup",
    "div",
    "form",
    "script",
    "table",
    "tbody",
    "tfoot",
    "thead",
    "tr",
];

for (i = 0; i < tags.length; ++i)
    shouldBe('checkCellNesting("' + tags[i] + '")', '0');

debug('');

shouldBe('checkCellNesting("td")', '1');
shouldBe('checkCellNesting("th")', '1');

debug('');

for (i = 0; i < tags.length; ++i)
    shouldBe('checkHeaderCellNesting("' + tags[i] + '")', '0');

debug('');

shouldBe('checkHeaderCellNesting("td")', '1');
shouldBe('checkHeaderCellNesting("th")', '1');

debug('');

var successfullyParsed = true;