tor-browser

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

test_bug895974.html (2546B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=895974
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 895974</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12 
     13  /** Test for Bug 895974 */
     14  SimpleTest.waitForExplicitFinish();
     15 
     16  addLoadEvent(function() {
     17  var frag = document.createDocumentFragment();
     18  var span = document.createElement("span");
     19  var div = document.createElement("div");
     20  var text = document.createTextNode("help");
     21  frag.appendChild(document.createTextNode("fail"));
     22  frag.appendChild(span);
     23  frag.appendChild(text);
     24  frag.appendChild(div);
     25  frag.appendChild(document.createTextNode("fail"));
     26 
     27  is(text.nextElementSibling, div, "nextElementSibling should work on text");
     28  is(text.previousElementSibling, span,
     29    "previousElementSibling should work on text");
     30 
     31  is(document.firstElementChild, document.documentElement,
     32     "firstElementChild should work on document");
     33  is(document.lastElementChild, document.documentElement,
     34     "lastElementChild should work on document");
     35  is(document.children.length, 1, "Document has one element kid");
     36  is(document.children[0], document.documentElement,
     37     "Document only element child is <html>");
     38 
     39  is(frag.firstElementChild, span,
     40     "firstElementChild should work on document fragment");
     41  is(frag.lastElementChild, div,
     42     "lastElementChild should work on document fragment");
     43  is(frag.children.length, 2, "Document fragment has two element kids");
     44  is(frag.children[0], span, "Document fragment first element child is span");
     45  is(frag.children[1], div, "Document fragment second element child is div");
     46 
     47  is(document.documentElement.firstElementChild, document.head,
     48     "firstElementChild should work on element");
     49  is(document.documentElement.lastElementChild, document.body,
     50     "lastElementChild should work on element");
     51  is(document.documentElement.children.length, 2, "<html> has two element kids");
     52  is(document.documentElement.children[0], document.head,
     53     "<html> first element child is head");
     54  is(document.documentElement.children[1], document.body,
     55     "<html>  second element child is body");
     56  SimpleTest.finish();
     57  });
     58  </script>
     59 </head>
     60 <body>
     61 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895974">Mozilla Bug 895974</a>
     62 <p id="display"></p>
     63 <div id="content" style="display: none">
     64 
     65 </div>
     66 <pre id="test">
     67 </pre>
     68 </body>
     69 </html>