tor-browser

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

TreeWalker-walking-outside-a-tree.html (1451B)


      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 Test adapted from https://github.com/operasoftware/presto-testo/blob/master/core/standards/acid3/individual/006a.html
      5 -->
      6 <head>
      7 <title>TreeWalker: walking-outside-a-tree</title>
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="support/assert-node.js"></script>
     11 <div id=log></div>
     12 </head>
     13 <body>
     14 <p>[Acid3 - Test 006a] walking outside a tree</p>
     15 <script>
     16 test(function () {
     17    // test 6: walking outside a tree
     18    var doc = document.createElement("div");
     19    var head = document.createElement('head');
     20    var title = document.createElement('title');
     21    var body = document.createElement('body');
     22    var p = document.createElement('p');
     23    doc.appendChild(head);
     24    head.appendChild(title);
     25    doc.appendChild(body);
     26    body.appendChild(p);
     27 
     28    var w = document.createTreeWalker(body, 0xFFFFFFFF, null);
     29    doc.removeChild(body);
     30    assert_equals(w.lastChild(), p, "TreeWalker failed after removing the current node from the tree");
     31    doc.appendChild(p);
     32    assert_equals(w.previousNode(), title, "failed to handle regrafting correctly");
     33    p.appendChild(body);
     34    assert_equals(w.nextNode(), p, "couldn't retrace steps");
     35    assert_equals(w.nextNode(), body, "couldn't step back into root");
     36    assert_equals(w.previousNode(), null, "root didn't retake its rootish position");
     37 }, "walking outside a tree");
     38 </script>
     39 </body>
     40 </html>