Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / duplicate-ids-document-order.html
blob8b99e9aaa37825b27807f2c1f4703cd831b8276e
1 <html>
2 <head>
3 <script>
4 function debug(str) {
5 text = document.createTextNode(str);
6 debugDiv = document.getElementById('debugDiv');
7 div = document.createElement('div');
8 div.appendChild(text);
9 debugDiv.appendChild(div);
12 function runTest() {
13 if (window.testRunner) {
14 testRunner.dumpAsText();
16 var div = document.getElementById("foo");
17 for (var i = 0; i < 5; ++i) {
18 var span = document.createElement("span");
19 span.appendChild(document.createTextNode(i));
20 span.setAttribute("id", "bar");
21 div.insertBefore(span, div.firstChild);
24 if (document.getElementById("bar").innerHTML == 4)
25 debug("Success");
26 else
27 debug("Failure");
29 </script>
30 </head>
31 <body onload="runTest()">
32 This tests that getElementById returns the first element in document order when there are multiple ids. Bug 12988.
33 <div style="display:none" id="foo">text</div>
34 <div id='debugDiv'>
35 </div>
36 </body>
37 </html>