OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script> | |
4 function print(message) | |
5 { | |
6 var paragraph = document.createElement("li"); | |
7 paragraph.appendChild(document.createTextNode(message)); | |
8 document.getElementById("console").appendChild(paragraph); | |
9 } | |
10 function isInCollection(collection, item) { | |
11 for(var i = 0; i < collection.length; i++) | |
12 if(collection[i] == item) | |
13 return true; | |
14 | |
15 return false; | |
16 } | |
17 function insert(table) { | |
18 try { | |
19 var insertedRow = table.insertRow(-1); | |
20 var error; | |
21 // Check that the insertedRow is in the table and that the table
now has at least one tBody | |
22 if(!isInCollection(table.rows, insertedRow)) { | |
23 print("Failed: Inserted row not found inside table"); return
; | |
24 } | |
25 if(table.tBodies.length == 0 && !table.tFoot && !table.tHead) { | |
26 print("Failed: Inserted row did not add an implicit tbody/tf
oot/thead"); return; | |
27 } | |
28 | |
29 print("Success"); | |
30 } | |
31 catch(e) { | |
32 print("Failed: " + e); | |
33 | |
34 } | |
35 } | |
36 function test() | |
37 { | |
38 if (window.testRunner) | |
39 testRunner.dumpAsText(); | |
40 | |
41 var tables = document.getElementsByTagName("table"); | |
42 for(var i = 0; tables[i]; i++) | |
43 insert(tables[i]); | |
44 | |
45 } | |
46 | |
47 </script> | |
48 <style> | |
49 table { | |
50 display: none; | |
51 } | |
52 </style> | |
53 </head> | |
54 <body onload="test();"> | |
55 <h3>HTMLTableElement's insertRow() method</h3> | |
56 <h4>The first three test whether HTMLTableElement's insertRow() method c
an add an implicit tbody into a table without one, to hold the inserted row.</h4
> | |
57 <p>The first tests an empty table</p> | |
58 <p>The second tests a table with text contents.</p> | |
59 <p>The third tests a table with only a form element inside.</p> | |
60 <h4>The next four test the method on typical cases.</h4> | |
61 <p>The first tests a table with only a thead</p> | |
62 <p>The second tests a table with only a tbody</p> | |
63 <p>The third tests a table with only a tfoot</p> | |
64 <p>The fourth tests a table with a few rows and cells</p> | |
65 <table></table> | |
66 <table> </table> | |
67 <table><form></form></table> | |
68 <table><thead></thead></table> | |
69 <table><tbody></tbody></table> | |
70 <table><tfoot></tfoot></table> | |
71 <table id="table7" width="100%" border="0" cellpadding="2" cellspacing="
0" bgcolor="#cccccc" style="border-top: 1px #999999 solid; border-bottom: 5px #0
00000 solid"> | |
72 <tr> | |
73 <td valign="middle" nowrap style="border-bottom: 2px #999999 solid"
width="100%"><font face="arial, sans-serif" size="-2"><a href="http://www.ostg.
com" title="OSTG - The Open Source Technology Group" style="text-decoration:none
"><font face="verdana" color="#001670"> <b>OSTG</b></font></a> |
<a href="http://sf.net" style="text-decoration: none">SourceForge</a> - <a
href="http://thinkgeek.com" style="text-decoration: none">ThinkGeek</a> - <
a href="http://slashdot.org/relocate.pl?id=12076d9d1d102290bbd8d6c328d9352d" sty
le="text-decoration: none">ITMJ</a> - <a href="http://linux.com" style="te
xt-decoration: none">Linux.com</a> - <a href="http://newsforge.com" style="
text-decoration: none">NewsForge</a> - <a href="http://freshmeat.net" style
="text-decoration: none">freshmeat</a> - <a href="http://newsletters.ostg.c
om" style="text-decoration: none">Newsletters</a> - <a href="http://slashdo
t.org/relocate.pl?id=0bd85aa57f4ab88f2d01c33b548b693c" style="text-decoration: n
one">Jobs</a> - <a href="http://slashdot.org/relocate.pl?id=776713765547209
fc2c05a83454efda2" style="text-decoration: none">Broadband</a> - <a href="h
ttp://slashdot.org/relocate.pl?id=237ae3c6bbb4992f4144befc67856103" style="text-
decoration: none">Whitepapers</a></font></td><td valign="middle" style="display:
hidden; border-bottom: 2px solid #999999" nowrap><b><A HREF="//slashdot.org/user
s.pl?op=savemiscopts&opt_osdn_navbar=0" style="text-decoration: none;"><font
size="-2" face="verdana" color="#666666"> X </font></a></b> | |
74 </td> | |
75 </tr> | |
76 </table> | |
77 | |
78 <hr> | |
79 <ol id="console"></ol> | |
80 </body> | |
81 </html> | |
OLD | NEW |