tFoot.html (1817B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>tFoot 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="thead"></thead><tbody id="tbody1"></tbody><tbody id="tbody2"></tbody><tfoot id="tfoot1"></tfoot><tfoot id="tfoot2"></tfoot><tfoot id="tfoot3"></tfoot></table> 8 <script> 9 test(function() { 10 var t = document.getElementById("t"); 11 var tfoot1 = document.getElementById("tfoot1"); 12 13 assert_equals(t.tFoot, tfoot1); 14 15 var tfoot2 = document.getElementById("tfoot2"); 16 t.tFoot = null; 17 18 assert_equals(t.tFoot, tfoot2); 19 20 var tfoot3 = document.getElementById("tfoot3"); 21 t.deleteTFoot(); 22 23 assert_equals(t.tFoot, tfoot3); 24 25 var tfoot = t.createTFoot(); 26 assert_equals(t.tFoot, tfoot); 27 assert_equals(tfoot, tfoot3); 28 29 t.deleteTFoot(); 30 assert_equals(t.tFoot, null); 31 32 var tbody2 = document.getElementById("tbody2"); 33 34 tfoot = t.createTFoot(); 35 assert_equals(t.tFoot, tfoot); 36 37 assert_equals(t.tFoot.previousSibling, tbody2); 38 assert_equals(t.tFoot.nextSibling, null); 39 40 t.deleteTFoot(); 41 assert_equals(t.tFoot, null); 42 43 t.tFoot = tfoot; 44 assert_equals(t.tFoot, tfoot); 45 46 assert_equals(t.tFoot.previousSibling, tbody2); 47 assert_equals(t.tFoot.nextSibling, null); 48 49 assert_throws_js(TypeError, function(){ 50 t.tFoot = document.createElement("div"); 51 }); 52 53 assert_throws_dom("HierarchyRequestError", function(){ 54 t.tFoot = document.createElement("thead"); 55 }); 56 }) 57 58 test(function () { 59 var table = document.createElementNS("http://www.w3.org/1999/xhtml", "foo:table") 60 var tfoot = table.createTFoot(); 61 62 assert_equals(table.tFoot, tfoot); 63 assert_equals(tfoot.prefix, null); 64 }); 65 </script>