OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <title>Creating and deleting captions</title> |
| 5 <link rel="author" title="Erika Navara" href="mailto:edoyle@microsoft.com"> |
| 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-table-eleme
nt" /> |
| 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-creat
ecaption" /> |
| 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-delet
ecaption" /> |
| 9 <script src="../../../../../../resources/testharness.js"></script> |
| 10 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <div id="log"></div> |
| 14 <table id="table1" style="display:none"> |
| 15 <caption id="caption1">caption</caption> |
| 16 <tr> |
| 17 <td>cell</td> |
| 18 <td>cell</td> |
| 19 </tr> |
| 20 </table> |
| 21 <table id="table2" style="display:none"> |
| 22 <tr> |
| 23 <td>cell</td> |
| 24 <td>cell</td> |
| 25 </tr> |
| 26 </table> |
| 27 <table id="table3" style="display:none"> |
| 28 <caption id="caption3">caption 3</caption> |
| 29 <tr> |
| 30 <td>cell</td> |
| 31 <td>cell</td> |
| 32 </tr> |
| 33 </table> |
| 34 <script> |
| 35 test(function () { |
| 36 var table1 = document.getElementById('table1'); |
| 37 var testCaption = table1.createCaption(); |
| 38 var table1FirstCaption = table1.caption; |
| 39 assert_equals(testCaption, table1FirstCaption); |
| 40 }, "createCaption method returns the first caption element child of the tabl
e") |
| 41 test(function () { |
| 42 var table2 = document.getElementById('table2'); |
| 43 var test2Caption = table2.createCaption(); |
| 44 var table2FirstNode = table2.firstChild; |
| 45 assert_true(test2Caption instanceof HTMLTableCaptionElement); |
| 46 assert_equals(table2FirstNode, test2Caption); |
| 47 }, "createCaption method creates a new caption and inserts it as the first n
ode of the table element") |
| 48 test(function () { |
| 49 var table3 = document.getElementById('table3'); |
| 50 assert_equals(table3.caption.textContent, "caption 3"); |
| 51 table3.deleteCaption(); |
| 52 assert_equals(table3.caption, null); |
| 53 }, "deleteCaption method removes the first caption element child of the tabl
e element") |
| 54 </script> |
| 55 </body> |
| 56 </html> |
OLD | NEW |