OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <title>HTML5 Table API Tests</title> |
| 5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> |
| 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> |
| 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-caption-e
lement" /> |
| 8 </head> |
| 9 <script src="../../../../../../resources/testharness.js"></script> |
| 10 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 11 <body> |
| 12 <div id="log"></div> |
| 13 <table id="table1" style="display:none"> |
| 14 <tr><td></td></tr> |
| 15 <caption>first caption</caption> |
| 16 <caption>second caption</caption> |
| 17 </table> |
| 18 <table id="table2" style="display:none"> |
| 19 <tr><td></td></tr> |
| 20 </table> |
| 21 <table id="table3" style="display:none"> |
| 22 <tr><td></td></tr> |
| 23 </table> |
| 24 <table id="table4" style="display:none"> |
| 25 <tr><td></td></tr> |
| 26 <caption>first caption</caption> |
| 27 </table> |
| 28 <script> |
| 29 test(function () { |
| 30 assert_equals(document.getElementById('table1').caption.innerHTML, "firs
t caption"); |
| 31 }, "first caption element child of the first table element"); |
| 32 |
| 33 test(function () { |
| 34 var caption = document.createElement("caption"); |
| 35 caption.innerHTML = "new caption"; |
| 36 var table = document.getElementById('table1'); |
| 37 table.caption = caption; |
| 38 |
| 39 assert_equals(caption.parentNode, table); |
| 40 assert_equals(table.caption.innerHTML, "new caption"); |
| 41 |
| 42 captions = table.getElementsByTagName('caption'); |
| 43 assert_equals(captions.length, 2); |
| 44 assert_equals(captions[0].innerHTML, "new caption"); |
| 45 assert_equals(captions[1].innerHTML, "second caption"); |
| 46 }, "setting caption on a table"); |
| 47 |
| 48 test(function () { |
| 49 assert_equals(document.getElementById('table2').caption, null); |
| 50 }, "caption IDL attribute is null"); |
| 51 |
| 52 test(function () { |
| 53 var table = document.getElementById('table3'); |
| 54 var caption = document.createElement("caption") |
| 55 table.rows[0].appendChild(caption); |
| 56 assert_equals(table.caption, null); |
| 57 }, "caption of the third table element should be null"); |
| 58 |
| 59 test(function () { |
| 60 assert_not_equals(document.getElementById('table4').caption, null); |
| 61 |
| 62 var parent = document.getElementById('table4').caption.parentNode; |
| 63 parent.removeChild(document.getElementById('table4').caption); |
| 64 |
| 65 assert_equals(document.getElementById('table4').caption, null); |
| 66 }, "dynamically removing caption on a table"); |
| 67 </script> |
| 68 </body> |
| 69 </html> |
OLD | NEW |