OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../js/resources/js-test-pre.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <p id="description"></p> | 6 <p id="description"></p> |
7 <div id='div1'>text1</div> | 7 <div id='div1'>text1</div> |
8 <div id='div2'>text2</div><br> | 8 <div id='div2'>text2</div><br> |
9 | 9 |
10 <div id="console"></div> | 10 <div id="console"></div> |
11 | 11 |
12 <script> | 12 <script> |
13 description('This tests that items in a NodeList can be retrieved directly by na
me.'); | 13 description('This tests that items in a NodeList can be retrieved directly by na
me.'); |
14 | 14 |
15 var NodeList = document.getElementsByTagName('div'); | 15 var NodeList = document.getElementsByTagName('div'); |
16 var div1 = NodeList.div1; | 16 var div1 = NodeList.div1; |
17 var div2 = NodeList.div2; | 17 var div2 = NodeList.div2; |
18 | 18 |
19 shouldBeTrue("div1 instanceof HTMLDivElement"); | 19 shouldBeTrue("div1 instanceof HTMLDivElement"); |
20 shouldBeTrue("div2 instanceof HTMLDivElement"); | 20 shouldBeTrue("div2 instanceof HTMLDivElement"); |
21 // Also check that the correct divs were retrieved. | 21 // Also check that the correct divs were retrieved. |
22 shouldBe("div1.innerHTML", "'text1'"); | 22 shouldBe("div1.innerHTML", "'text1'"); |
23 shouldBe("div2.innerHTML", "'text2'"); | 23 shouldBe("div2.innerHTML", "'text2'"); |
24 </script> | 24 </script> |
25 </body> | 25 </body> |
26 </html> | 26 </html> |
OLD | NEW |