tor-browser

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

test_bug295561.html (2901B)


      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=295561
      5 -->
      6 <head>
      7  <title>Test for Bug 295561</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=295561">Mozilla Bug 295561</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none">
     15 
     16 <table id="testTable">
     17 <thead>
     18 <tr id="headRow"><td></td></tr>
     19 </thead>
     20 <tfoot>
     21 <tr id="footRow"><td></td></tr>
     22 </tfoot>
     23 <tbody id="tBody" name="namedTBody">
     24 <tr id="trow" name="namedTRow">
     25 <td id="tcell" name="namedTCell"></td>
     26 <th id="tcellh" name="namedTH"></th>
     27 </tr>
     28 <tr><td></td></tr>
     29 </tbody>
     30 <tbody id="tBody2" name="namedTBody2">
     31 <tr id="trow2" name="namedTRow2">
     32 <td id="tcell2" name="namedTCell2"></td>
     33 <th id="tcellh2" name="namedTH2"></th>
     34 </tr>
     35 </table>
     36  
     37 </div>
     38 <pre id="test">
     39 <script class="testbody" type="text/javascript">
     40 
     41 function testItById(id, collection, collectionName) {
     42  is(collection[id], $(id), 
     43     "Should be able to get by id '" + id + "' from " + collectionName +
     44     " collection using square brackets.")
     45  is(collection.namedItem(id), $(id), 
     46     "Should be able to get by id '" + id + "' from " + collectionName +
     47     " collection using namedItem.")
     48 }
     49 
     50 function testItByName(name, id, collection, collectionName) {
     51  is(collection[name], $(id), 
     52     "Should be able to get by name '" + name + "' from " + collectionName +
     53     " collection using square brackets.")
     54  is(collection.namedItem(name), $(id), 
     55     "Should be able to get by name '" + name + "' from " + collectionName +
     56     " collection using namedItem.")
     57 }
     58 
     59 function testIt(name, id, collection, collectionName) {
     60  testItByName(name, id, collection, collectionName);
     61  testItById(id, collection, collectionName);
     62 }
     63 
     64 var table = $("testTable")
     65 testIt("namedTBody", "tBody",  table.tBodies,     "tBodies")
     66 testIt("namedTRow", "trow",   table.rows,        "table rows")
     67 testIt("namedTRow", "trow",   $("tBody").rows,   "tbody rows")
     68 testIt("namedTCell", "tcell",  $("trow").cells,   "cells")
     69 testIt("namedTH", "tcellh", $("trow").cells,   "cells")
     70 testIt("namedTBody2", "tBody2",  table.tBodies,     "tBodies")
     71 testIt("namedTRow2", "trow2",   table.rows,        "table rows")
     72 testIt("namedTRow2", "trow2",   $("tBody2").rows,   "tbody rows")
     73 testIt("namedTCell2", "tcell2",  $("trow2").cells,   "cells")
     74 testIt("namedTH2", "tcellh2", $("trow2").cells,   "cells")
     75 is(table.tBodies.length, 2, "Incorrect tBodies length");
     76 is(table.rows.length, 5, "Incorrect rows length");
     77 is(table.rows[0], $("headRow"), "THead row in wrong spot");
     78 is(table.rows[1], $("trow"), "First tbody row in wrong spot");
     79 is(table.rows[3], $("trow2"), "Second tbody row in wrong spot");
     80 is(table.rows[4], $("footRow"), "TFoot row in wrong spot");
     81 
     82 
     83 </script>
     84 </pre>
     85 </body>
     86 </html>