dom/tests/mochitest/general/test_for_of.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/test_for_of.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Tests for for-of loops</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
    1.10 +</head>
    1.11 +<body onload="doTest()">
    1.12 +<p id="display"></p>
    1.13 +<div id="content" style="display: none"></div>
    1.14 +<script>
    1.15 +function doTest() {
    1.16 +  // DOM NodeLists are iterable.
    1.17 +  var a = [];
    1.18 +  for (var e of document.body.childNodes)
    1.19 +    if (e.nodeType === 1)
    1.20 +      a.push(e.tagName); 
    1.21 +  is("P DIV SCRIPT", a.join(" "), "for-of should see each element in the body");
    1.22 +
    1.23 +  SimpleTest.finish();
    1.24 +}
    1.25 +SimpleTest.waitForExplicitFinish();
    1.26 +</script>
    1.27 +</body>
    1.28 +</html>

mercurial