tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

caption_001.html (2597B)


      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-element" />
      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, "first 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.firstChild, caption);
     41        assert_equals(table.caption.innerHTML, "new caption");
     42 
     43        captions = table.getElementsByTagName('caption');
     44        assert_equals(captions.length, 2);
     45        assert_equals(captions[0].innerHTML, "new caption");
     46        assert_equals(captions[1].innerHTML, "second caption");
     47      }, "setting caption on a table");
     48 
     49      test(function () {
     50        assert_equals(document.getElementById('table2').caption, null);
     51      }, "caption IDL attribute is null");
     52 
     53      test(function () {
     54        var table = document.getElementById('table3');
     55        var caption = document.createElement("caption")
     56        table.rows[0].appendChild(caption);
     57        assert_equals(table.caption, null);
     58      }, "caption of the third table element should be null");
     59 
     60      test(function () {
     61        assert_not_equals(document.getElementById('table4').caption, null);
     62 
     63        var parent = document.getElementById('table4').caption.parentNode;
     64        parent.removeChild(document.getElementById('table4').caption);
     65 
     66        assert_equals(document.getElementById('table4').caption, null);
     67      }, "dynamically removing caption on a table");
     68    </script>
     69  </body>
     70 </html>