tor-browser

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

insertRow-method-03.html (1177B)


      1 <!DOCTYPE html>
      2 <title>insertRow(): non-empty table</title>
      3 <link rel="author" title="g-k" href="mailto:greg.guthe@gmail.com">
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-insertrow">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="log"></div>
      8 <div id="test">
      9    <table>
     10        <tbody><tr id="first"></tr><tr id="second"></tr></tbody>
     11    </table>
     12 </div>
     13 <script>
     14 var HTML = "http://www.w3.org/1999/xhtml";
     15 test(function() {
     16  var table = document.getElementById("test").getElementsByTagName("table")[0];
     17  test(function() {
     18    assert_equals(table.childNodes.length, 3);
     19    assert_equals(table.rows.length, 2);
     20  }, "table should start out with two rows")
     21 
     22  var tr;
     23  test(function() {
     24    tr = table.insertRow(1);
     25    assert_equals(tr.localName, "tr");
     26    assert_equals(tr.namespaceURI, HTML);
     27    assert_equals(table.getElementsByTagName("tr")[0].id, "first");
     28    assert_equals(table.getElementsByTagName("tr")[1].id, "");
     29    assert_equals(table.getElementsByTagName("tr")[2].id, "second");
     30  }, "insertRow should insert a tr element before the second row")
     31 });
     32 </script>