test_bug259332.html (1584B)
1 <html> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=259332 4 --> 5 <head> 6 <title>Test for Bug 259332</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=259332">Mozilla Bug 259332</a> 12 <p id="display"></p> 13 <div id="content"> 14 <div id="a">a 15 <div id="a">a</div> 16 <input name="a" value="a"> 17 <div id="b">b</div> 18 <input name="b" value="b"> 19 <div id="c">c</div> 20 </div> 21 <input name="write"> 22 <input name="write"> 23 <input id="write"> 24 </div> 25 <pre id="test"> 26 <script class="testbody" type="text/javascript"> 27 28 /** Test for Bug 259332 */ 29 30 list = document.all.a; 31 ok(list.length == 3, "initial a length"); 32 33 blist = document.all.b; 34 ok(document.all.b.length == 2, "initial b length"); 35 document.getElementById('b').id = 'a'; 36 ok(document.all.b.nodeName == "INPUT", "just one b"); 37 38 ok(blist.length == 1, "just one b"); 39 ok(list.length == 4, "one more a"); 40 41 newDiv = document.createElement('div'); 42 newDiv.id = 'a'; 43 newDiv.innerHTML = 'a'; 44 list[0].appendChild(newDiv); 45 ok(list.length == 5, "two more a"); 46 47 ok(document.all.c.textContent == 'c', "one c"); 48 document.all.c.id = 'a'; 49 ok(!document.all.c, "no c"); 50 ok(list.length == 6, "three more a"); 51 52 ok(document.all.write.length == 3, "name is write"); 53 54 newDiv = document.createElement('div'); 55 newDiv.id = 'd'; 56 newDiv.innerHTML = 'd'; 57 list[0].appendChild(newDiv); 58 ok(document.all.d.textContent == 'd', "new d"); 59 60 61 </script> 62 </pre> 63 </body> 64 </html>