tor-browser

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

test_formelements.html (1971B)


      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  <form id="f">
     17    <input name="x">
     18    <input type="image" name="a">
     19    <input type="file" name="y">
     20    <input type="submit" name="z">
     21    <input id="w">
     22    <input name="w">
     23  </form>
     24 </div>
     25 <pre id="test">
     26 <script type="application/javascript">
     27 
     28 /** Test for Bug 772869 */
     29 var x = $("f").elements;
     30 x.something = "another";
     31 names = [];
     32 for (var name in x) {
     33  names.push(name);
     34 }
     35 is(names.length, 9, "Should have 9 enumerated names");
     36 is(names[0], "0", "Enum entry 1");
     37 is(names[1], "1", "Enum entry 2");
     38 is(names[2], "2", "Enum entry 3");
     39 is(names[3], "3", "Enum entry 4");
     40 is(names[4], "4", "Enum entry 5");
     41 is(names[5], "something", "Enum entry 6");
     42 is(names[6], "namedItem", "Enum entry 7");
     43 is(names[7], "item", "Enum entry 8");
     44 is(names[8], "length", "Enum entry 9");
     45 
     46 names = Object.getOwnPropertyNames(x);
     47 is(names.length, 10, "Should have 10 items");
     48 // Now sort entries 5 through 8, for comparison purposes.  We don't sort the
     49 // whole array, because we want to make sure the ordering between the parts
     50 // is correct
     51 temp = names.slice(5, 9);
     52 temp.sort();
     53 names.splice.bind(names, 5, 4).apply(null, temp);
     54 is(names.length, 10, "Should still have 10 items");
     55 is(names[0], "0", "Entry 1")
     56 is(names[1], "1", "Entry 2")
     57 is(names[2], "2", "Entry 3")
     58 is(names[3], "3", "Entry 4")
     59 is(names[4], "4", "Entry 5")
     60 is(names[5], "w", "Entry 6")
     61 is(names[6], "x", "Entry 7")
     62 is(names[7], "y", "Entry 8")
     63 is(names[8], "z", "Entry 9")
     64 is(names[9], "something", "Entry 10")
     65 </script>
     66 </pre>
     67 </body>
     68 </html>