test_for_of.html (644B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Tests for for-of loops</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> 7 </head> 8 <body onload="doTest()"> 9 <p id="display"></p> 10 <div id="content" style="display: none"></div> 11 <script> 12 function doTest() { 13 // DOM NodeLists are iterable. 14 var a = []; 15 for (var e of document.body.childNodes) 16 if (e.nodeType === 1) 17 a.push(e.tagName); 18 is("P DIV SCRIPT", a.join(" "), "for-of should see each element in the body"); 19 20 SimpleTest.finish(); 21 } 22 SimpleTest.waitForExplicitFinish(); 23 </script> 24 </body> 25 </html>