| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../js/resources/js-test-pre.js"></script> | 3 <script src="../../js/resources/js-test-pre.js"></script> |
| 4 </head> | 4 </head> |
| 5 <body> | 5 <body> |
| 6 | 6 |
| 7 <div name='name1' id='id1'/> | 7 <div name='name1' id='id1'/> |
| 8 <div name='name2' id='id2'/> | 8 <div name='name2' id='id2'/> |
| 9 <div name='name3' id='id2'/> | 9 <div name='name3' id='id2'/> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 description("Test getElementById"); | 12 description("Test getElementById"); |
| 13 | 13 |
| 14 var elem; | 14 var elem; |
| 15 | 15 |
| 16 // element found with exact match | 16 // element found with exact match |
| 17 elem = document.getElementById('id1'); | 17 elem = document.getElementById('id1'); |
| 18 shouldBe('elem.getAttribute("name")', '"name1"'); | 18 shouldBe('elem.getAttribute("name")', '"name1"'); |
| 19 | 19 |
| 20 // multiple elements having same id return the first one | 20 // multiple elements having same id return the first one |
| 21 elem = document.getElementById('id2'); | 21 elem = document.getElementById('id2'); |
| 22 shouldBe('elem.getAttribute("name")', '"name2"'); | 22 shouldBe('elem.getAttribute("name")', '"name2"'); |
| 23 | 23 |
| 24 // element with id not found | 24 // element with id not found |
| 25 elem = document.getElementById('id3'); | 25 elem = document.getElementById('id3'); |
| 26 shouldBeNull('elem'); | 26 shouldBeNull('elem'); |
| 27 </script> | 27 </script> |
| 28 <script src="../../js/resources/js-test-post.js"></script> | |
| 29 </body> | 28 </body> |
| 30 </html> | 29 </html> |
| OLD | NEW |