| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id='div1'>text1</div> |
| <div id='div2'>text2</div><br> |
| |
| <div id="console"></div> |
| |
| <script> |
| description('This tests that items in a NodeList can be retrieved directly by name.'); |
| |
| var NodeList = document.getElementsByTagName('div'); |
| var div1 = NodeList.div1; |
| var div2 = NodeList.div2; |
| |
| shouldBeTrue("div1 instanceof HTMLDivElement"); |
| shouldBeTrue("div2 instanceof HTMLDivElement"); |
| // Also check that the correct divs were retrieved. |
| shouldBe("div1.innerHTML", "'text1'"); |
| shouldBe("div2.innerHTML", "'text2'"); |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |