5 console
= document
.getElementById('console');
7 li
= document
.createElement('li');
8 console
.appendChild(li
);
9 li
.appendChild(document
.createTextNode(str
));
13 if (window
.testRunner
) {
14 testRunner
.dumpAsText();
16 div
= document
.getElementById('duplicate');
17 dup1
= div
.parentNode
.removeChild(div
);
19 div
= document
.getElementById('duplicate');
21 debug('Failed: getElementById returned null');
25 if (div
.firstChild
.nodeValue
!= 'This is the second duplicate div') {
26 debug('Failed: getElementById returned the wrong div');
30 dup2
= div
.parentNode
.removeChild(div
);
31 if (document
.getElementById('duplicate')) {
32 debug('Failed: getElementById did not return null');
36 // Now insert the nodes again
37 container
= document
.getElementById('container');
38 container
.appendChild(dup1
);
39 container
.appendChild(dup2
);
41 if (!document
.getElementById('duplicate')) {
42 debug('Failed: getElementById returned null');
50 <body onLoad=
"runTests()">
51 This tests that getElementById works as elements with duplicate ids are added and removed. If the test is successful, the text
"success" should be shown below.
53 <div id=
"duplicate">This is the first duplicate div
</div>
54 <div id=
"duplicate">This is the second duplicate div
</div>