tor-browser

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

test_bug403868.xml (2683B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=403868
      4 -->
      5 <head>
      6  <title>Test for Bug 403868</title>
      7  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body>
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=403868">Mozilla Bug 403868</a>
     12 <p id="display"></p>
     13 <div id="content" style="display: none">
     14  
     15 </div>
     16 <pre id="test">
     17 <script class="testbody" type="text/javascript">
     18 <![CDATA[
     19 
     20 /** Test for Bug 403868 **/
     21 function createSpan(id, insertionPoint) {
     22  var s = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
     23  s.id = id;
     24  $("content").insertBefore(s, insertionPoint);
     25  return s;
     26 }
     27 
     28 var s1a = createSpan("test1", null);
     29 is(document.getElementById("test1"), s1a,
     30   "Only one span with id=test1 in the tree; should work!");
     31 
     32 var s2a = createSpan("test1", null);
     33 is(document.getElementById("test1"), s1a,
     34   "Appending span with id=test1 doesn't change which one comes first");
     35 
     36 var s3a = createSpan("test1", s2a);
     37 is(document.getElementById("test1"), s1a,
     38   "Inserting span with id=test1 not at the beginning; doesn't matter");
     39 
     40 var s4a = createSpan("test1", s1a);
     41 is(document.getElementById("test1"), s4a,
     42   "Inserting span with id=test1 at the beginning changes which one is first");
     43 
     44 s4a.parentNode.removeChild(s4a);
     45 is(document.getElementById("test1"), s1a,
     46   "First-created span with id=test1 is first again");
     47 
     48 s1a.parentNode.removeChild(s1a);
     49 is(document.getElementById("test1"), s3a,
     50   "Third-created span with id=test1 is first now");
     51 
     52 // Start the id hashtable
     53 for (var i = 0; i < 256; ++i) {
     54  document.getElementById("no-such-id-in-the-document" + i);
     55 }
     56 
     57 var s1b = createSpan("test2", null);
     58 is(document.getElementById("test2"), s1b,
     59   "Only one span with id=test2 in the tree; should work!");
     60 
     61 var s2b = createSpan("test2", null);
     62 is(document.getElementById("test2"), s1b,
     63   "Appending span with id=test2 doesn't change which one comes first");
     64 
     65 var s3b = createSpan("test2", s2b);
     66 is(document.getElementById("test2"), s1b,
     67   "Inserting span with id=test2 not at the beginning; doesn't matter");
     68 
     69 var s4b = createSpan("test2", s1b);
     70 is(document.getElementById("test2"), s4b,
     71   "Inserting span with id=test2 at the beginning changes which one is first");
     72 
     73 s4b.parentNode.removeChild(s4b);
     74 is(document.getElementById("test2"), s1b,
     75   "First-created span with id=test2 is first again");
     76 
     77 s1b.parentNode.removeChild(s1b);
     78 is(document.getElementById("test2"), s3b,
     79   "Third-created span with id=test2 is first now");
     80 ]]>
     81 </script>
     82 </pre>
     83 </body>
     84 </html>