Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / test / test_named_options.html
blob8c38425240c665e1913b35a28cc3fd84417af2a7
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 <select id="s">
17 <option name="x"></option>
18 <option name="y" id="z"></option>
19 <option name="z" id="x"></option>
20 <option id="w"></option>
21 </select>
22 </div>
23 <pre id="test">
24 <script type="application/javascript">
26 /** Test for Bug 772869 **/
27 var opt = $("s").options;
28 opt.loopy = "something"
29 var names = Object.getOwnPropertyNames(opt);
30 is(names.length, 9, "Should have nine entries");
31 is(names[0], "0", "Entry 1")
32 is(names[1], "1", "Entry 2")
33 is(names[2], "2", "Entry 3")
34 is(names[3], "3", "Entry 4")
35 is(names[4], "x", "Entry 5")
36 is(names[5], "y", "Entry 6")
37 is(names[6], "z", "Entry 7")
38 is(names[7], "w", "Entry 8")
39 is(names[8], "loopy", "Entry 9")
41 var names2 = [];
42 for (var name in opt) {
43 names2.push(name);
45 is(names2.length, 11, "Should have eleven enumerated names");
46 is(names2[0], "0", "Enum entry 1")
47 is(names2[1], "1", "Enum entry 2")
48 is(names2[2], "2", "Enum entry 3")
49 is(names2[3], "3", "Enum entry 4")
50 is(names2[4], "loopy", "Enum entry 5")
51 is(names2[5], "add", "Enum entrry 6")
52 is(names2[6], "remove", "Enum entry 7")
53 is(names2[7], "length", "Enum entry 8")
54 is(names2[8], "selectedIndex", "Enum entry 9")
55 is(names2[9], "item", "Enum entry 10")
56 is(names2[10], "namedItem", "Enum entry 11")
58 </script>
59 </pre>
60 </body>
61 </html>