tor-browser

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

insertRow.html (1551B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTMLTableSectionElement#insertRow</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com/">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 
      8 <div id ="log"></div>
      9 
     10 <table>
     11  <tbody id="testBody">
     12    <tr><td>ABCDEF</td></tr>
     13  </tbody>
     14 </table>
     15 
     16 <script>
     17 
     18 var tbody = document.getElementById("testBody");
     19 
     20 test(function () {
     21  var trEle = tbody.insertRow(0);
     22  assert_equals(tbody.rows[0], trEle);
     23  assert_equals(tbody.rows.length, 2);
     24 }, "HTMLTableSectionElement insertRow(0)");
     25 
     26 test(function () {
     27  var trEle = tbody.insertRow(-1);
     28  assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
     29  assert_equals(tbody.rows.length, 3);
     30 }, "HTMLTableSectionElement insertRow(-1)");
     31 
     32 test(function () {
     33  var trEle = tbody.insertRow();
     34  assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
     35  assert_equals(tbody.rows.length, 4);
     36 }, "HTMLTableSectionElement insertRow()");
     37 
     38 test(function () {
     39  var trEle = tbody.insertRow(tbody.rows.length);
     40  assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
     41  assert_equals(tbody.rows.length, 5);
     42 }, "HTMLTableSectionElement insertRow(rows.length)");
     43 
     44 test(function () {
     45  assert_throws_dom("IndexSizeError", function () {
     46    tbody.insertRow(-2);
     47  });
     48 }, "HTMLTableSectionElement insertRow(-2)");
     49 
     50 test(function () {
     51  assert_throws_dom("IndexSizeError", function () {
     52    tbody.insertRow(tbody.rows.length + 1);
     53  });
     54 }, "HTMLTableSectionElement insertRow(rows.length + 1)");
     55 
     56 </script>