OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <script src="../../../resources/js-test.js"></script> | |
5 </head> | |
6 <body> | |
7 <script> | |
8 description('Test behavior of the HTMLTableElement rows attribute in cases where
there is unusual nesting.'); | |
9 | |
10 function checkNoBodyRowNesting(tag) | |
11 { | |
12 var table = document.createElement("table"); | |
13 var container = document.createElement(tag); | |
14 var row = document.createElement("tr"); | |
15 table.appendChild(container); | |
16 container.appendChild(row); | |
17 return table.rows.length; | |
18 } | |
19 | |
20 function checkRowNesting(tag) | |
21 { | |
22 var table = document.createElement("table"); | |
23 var body = document.createElement("tbody"); | |
24 var container = document.createElement(tag); | |
25 var row = document.createElement("tr"); | |
26 table.appendChild(body); | |
27 body.appendChild(container); | |
28 container.appendChild(row); | |
29 return table.rows.length; | |
30 } | |
31 | |
32 var sectionTags = [ | |
33 "tbody", | |
34 "tfoot", | |
35 "thead", | |
36 ]; | |
37 | |
38 var otherTags = [ | |
39 "col", | |
40 "colgroup", | |
41 "div", | |
42 "form", | |
43 "script", | |
44 "table", | |
45 "td", | |
46 "th", | |
47 ]; | |
48 | |
49 for (i = 0; i < otherTags.length; ++i) | |
50 shouldBe('checkRowNesting("' + otherTags[i] + '")', '0'); | |
51 | |
52 debug(''); | |
53 | |
54 for (i = 0; i < sectionTags.length; ++i) | |
55 shouldBe('checkRowNesting("' + sectionTags[i] + '")', '0'); | |
56 | |
57 debug(''); | |
58 | |
59 shouldBe('checkRowNesting("tr")', '1'); | |
60 | |
61 debug(''); | |
62 | |
63 for (i = 0; i < otherTags.length; ++i) | |
64 shouldBe('checkNoBodyRowNesting("' + otherTags[i] + '")', '0'); | |
65 | |
66 debug(''); | |
67 | |
68 for (i = 0; i < sectionTags.length; ++i) | |
69 shouldBe('checkNoBodyRowNesting("' + sectionTags[i] + '")', '1'); | |
70 | |
71 debug(''); | |
72 | |
73 shouldBe('checkNoBodyRowNesting("tr")', '1'); | |
74 | |
75 debug(''); | |
76 </script> | |
77 </body> | |
78 </html> | |
OLD | NEW |