1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=403868
6 <title>Test for Bug
403868</title>
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=403868">Mozilla Bug
403868</a>
13 <div id=
"content" style=
"display: none">
17 <script class=
"testbody" type=
"text/javascript">
20 /** Test for Bug
403868 **/
21 function createSpan(id, insertionPoint) {
22 var s = document.createElementNS(
"http://www.w3.org/1999/xhtml",
"span");
24 $(
"content").insertBefore(s, insertionPoint);
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");
45 is(document.getElementById(
"test1"), s1a,
46 "First-created span with id=test1 is first again");
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");
74 is(document.getElementById(
"test2"), s1b,
75 "First-created span with id=test2 is first again");
78 is(document.getElementById(
"test2"), s3b,
79 "Third-created span with id=test2 is first now");