tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / dom / HTMLTableRowElement / script-tests / cells.js
1 description('Test behavior of the HTMLTableRowElement cells attribute in cases where there is unusual nesting.');
2
3 function 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
13 function 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
23 var tags = [
24     "col",
25     "colgroup",
26     "div",
27     "form",
28     "script",
29     "table",
30     "tbody",
31     "tfoot",
32     "thead",
33     "tr",
34 ];
35
36 for (i = 0; i < tags.length; ++i)
37     shouldBe('checkCellNesting("' + tags[i] + '")', '0');
38
39 debug('');
40
41 shouldBe('checkCellNesting("td")', '1');
42 shouldBe('checkCellNesting("th")', '1');
43
44 debug('');
45
46 for (i = 0; i < tags.length; ++i)
47     shouldBe('checkHeaderCellNesting("' + tags[i] + '")', '0');
48
49 debug('');
50
51 shouldBe('checkHeaderCellNesting("td")', '1');
52 shouldBe('checkHeaderCellNesting("th")', '1');
53
54 debug('');