tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_htmlcollection.html (1574B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=772869
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 772869</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=772869">Mozilla Bug 772869</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16  <a class="foo" name="x"></a>
     17  <span class="foo" id="y"></span>
     18  <span class="foo" name="x"></span>
     19  <form class="foo" name="z" id="w"></form>
     20 </div>
     21 <pre id="test">
     22 <script type="application/javascript">
     23 
     24 /** Test for Bug 772869 */
     25 var x = document.getElementsByClassName("foo");
     26 x.something = "another";
     27 var names = [];
     28 for (var name in x) {
     29  names.push(name);
     30 }
     31 is(names.length, 8, "Should have 8 enumerated names");
     32 is(names[0], "0", "Enum entry 1")
     33 is(names[1], "1", "Enum entry 2")
     34 is(names[2], "2", "Enum entry 3")
     35 is(names[3], "3", "Enum entry 4")
     36 is(names[4], "something", "Enum entry 5")
     37 is(names[5], "item", "Enum entry 6")
     38 is(names[6], "namedItem", "Enum entry 7")
     39 is(names[7], "length", "Enum entry 8");
     40 
     41 names = Object.getOwnPropertyNames(x);
     42 is(names.length, 9, "Should have 9 items");
     43 is(names[0], "0", "Entry 1")
     44 is(names[1], "1", "Entry 2")
     45 is(names[2], "2", "Entry 3")
     46 is(names[3], "3", "Entry 4")
     47 is(names[4], "x", "Entry 5")
     48 is(names[5], "y", "Entry 6")
     49 is(names[6], "w", "Entry 7")
     50 is(names[7], "z", "Entry 8")
     51 is(names[8], "something", "Entry 9")
     52 </script>
     53 </pre>
     54 </body>
     55 </html>