Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / test / test_bug403868.html
blob43118a0683b5bc134d4dfaa78b33766140560fa6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=403868
5 -->
6 <head>
7 <title>Test for Bug 403868</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=403868">Mozilla Bug 403868</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 /** Test for Bug 403868 **/
21 function createSpan(id, insertionPoint) {
22 var s = document.createElement("span");
23 s.id = id;
24 $("content").insertBefore(s, insertionPoint);
25 return s;
28 var s1a = createSpan("test1", null);
29 is(document.getElementById("test1"), s1a,
30 "Only one span with id=test1 in the tree; should work!");
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");
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");
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");
44 s4a.remove();
45 is(document.getElementById("test1"), s1a,
46 "First-created span with id=test1 is first again");
48 s1a.remove();
49 is(document.getElementById("test1"), s3a,
50 "Third-created span with id=test1 is first now");
52 // Start the id hashtable
53 for (var i = 0; i < 256; ++i) {
54 document.getElementById("no-such-id-in-the-document" + i);
57 var s1b = createSpan("test2", null);
58 is(document.getElementById("test2"), s1b,
59 "Only one span with id=test2 in the tree; should work!");
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");
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");
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");
73 s4b.remove();
74 is(document.getElementById("test2"), s1b,
75 "First-created span with id=test2 is first again");
77 s1b.remove();
78 is(document.getElementById("test2"), s3b,
79 "Third-created span with id=test2 is first now");
83 </script>
84 </pre>
85 </body>
86 </html>