Bug 1882465 - Update .hg-annotate-ignore-revs and .git-blame-ignore-revs to reflect...
[gecko.git] / dom / xul / test / test_bug403868.xhtml
blobc2427bb64484f47fafc6ef434b8ded42376bb7b2
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=403868
6 -->
7 <window title="Mozilla Bug 403868"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=403868"
14 target="_blank">Mozilla Bug 403868</a>
15 <div id="content" style="display: none"/>
16 </body>
18 <!-- test code goes here -->
19 <script type="application/javascript"><![CDATA[
21 /** Test for Bug 403868 **/
22 function createSpan(id, insertionPoint) {
23 var s = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
24 s.id = id;
25 $("content").insertBefore(s, insertionPoint);
26 return s;
29 var s1a = createSpan("test1", null);
30 is(document.getElementById("test1"), s1a,
31 "Only one span with id=test1 in the tree; should work!");
33 var s2a = createSpan("test1", null);
34 is(document.getElementById("test1"), s1a,
35 "Appending span with id=test1 doesn't change which one comes first");
37 var s3a = createSpan("test1", s2a);
38 is(document.getElementById("test1"), s1a,
39 "Inserting span with id=test1 not at the beginning; doesn't matter");
41 var s4a = createSpan("test1", s1a);
42 is(document.getElementById("test1"), s4a,
43 "Inserting span with id=test1 at the beginning changes which one is first");
45 s4a.remove();
46 is(document.getElementById("test1"), s1a,
47 "First-created span with id=test1 is first again");
49 s1a.remove();
50 is(document.getElementById("test1"), s3a,
51 "Third-created span with id=test1 is first now");
53 // Start the id hashtable
54 for (var i = 0; i < 256; ++i) {
55 document.getElementById("no-such-id-in-the-document" + i);
58 var s1b = createSpan("test2", null);
59 is(document.getElementById("test2"), s1b,
60 "Only one span with id=test2 in the tree; should work!");
62 var s2b = createSpan("test2", null);
63 is(document.getElementById("test2"), s1b,
64 "Appending span with id=test2 doesn't change which one comes first");
66 var s3b = createSpan("test2", s2b);
67 is(document.getElementById("test2"), s1b,
68 "Inserting span with id=test2 not at the beginning; doesn't matter");
70 var s4b = createSpan("test2", s1b);
71 is(document.getElementById("test2"), s4b,
72 "Inserting span with id=test2 at the beginning changes which one is first");
74 s4b.remove();
75 is(document.getElementById("test2"), s1b,
76 "First-created span with id=test2 is first again");
78 s1b.remove();
79 is(document.getElementById("test2"), s3b,
80 "Third-created span with id=test2 is first now");
82 ]]></script>
83 </window>