tor-browser

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

tHead.html (1954B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>tHead tests</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <table id="t">
      7 <caption id="tcaption"></caption><thead id="thead1"></thead><thead id="thead2"></thead><thead id="thead3"></thead><tbody id="tbody1"></tbody><tbody id="tbody2"></tbody><tfoot id="tfoot"></tfoot>
      8 </table>
      9 <table>
     10 <thead id="t2thead">
     11 <td>
     12 <table id="t2">
     13 </table>
     14 </table>
     15 <script>
     16 test(function() {
     17    var t = document.getElementById("t");
     18    var thead1 = document.getElementById("thead1");
     19 
     20    assert_equals(t.tHead, thead1);
     21 
     22    var thead2 = document.getElementById("thead2");
     23    t.tHead = null;
     24 
     25    assert_equals(t.tHead, thead2);
     26 
     27    var thead3 = document.getElementById("thead3");
     28    t.deleteTHead();
     29 
     30    assert_equals(t.tHead, thead3);
     31 
     32    var thead = t.createTHead();
     33    assert_equals(t.tHead, thead);
     34    assert_equals(thead, thead3);
     35 
     36    t.deleteTHead();
     37    assert_equals(t.tHead, null);
     38 
     39    var tcaption = document.getElementById("tcaption");
     40    var tbody1 = document.getElementById("tbody1");
     41 
     42    thead = t.createTHead();
     43    assert_equals(t.tHead, thead);
     44 
     45    assert_equals(t.tHead.previousSibling, tcaption);
     46    assert_equals(t.tHead.nextSibling, tbody1);
     47 
     48    assert_throws_js(TypeError, function(){
     49        t.tHead = document.createElement("div");
     50    });
     51 
     52    assert_throws_dom("HierarchyRequestError", function(){
     53        t.tHead = document.createElement("tbody");
     54    });
     55 
     56 });
     57 
     58 test(function() {
     59    var t2 = document.getElementById("t2");
     60    var t2thead = document.getElementById("t2thead");
     61 
     62    assert_throws_dom("HierarchyRequestError", function() {
     63        t2.tHead = t2thead;
     64    });
     65 });
     66 
     67 test(function () {
     68    var table = document.createElementNS("http://www.w3.org/1999/xhtml", "foo:table")
     69    var thead = table.createTHead();
     70 
     71    assert_equals(table.tHead, thead);
     72    assert_equals(thead.prefix, null);
     73 });
     74 </script>