test_bug666200.html (1142B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=666200 5 --> 6 <head> 7 <title>Test for Bug 666200</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666200">Mozilla Bug 666200</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 </div> 16 <pre id="test"> 17 <script class="testbody" type="text/javascript"> 18 /** Test for Bug 666200 */ 19 var sel = document.createElement("select"); 20 var opt1 = new Option(); 21 var opt2 = new Option(); 22 var opt3 = new Option(); 23 var opt4 = new Option(); 24 var opt5 = new Option(); 25 opt1.value = 1; 26 opt2.value = 2; 27 opt3.value = 3; 28 opt4.value = 4; 29 opt5.value = 5; 30 sel.add(opt1); 31 sel.add(opt2, 0); 32 sel.add(opt3, 1000); 33 sel.options.add(opt4, opt3); 34 sel.add(opt5, undefined); 35 is(sel[0], opt2, "1st item should be 2"); 36 is(sel[1], opt1, "2nd item should be 1"); 37 is(sel[2], opt4, "3rd item should be 4"); 38 is(sel[3], opt3, "4th item should be 3"); 39 is(sel[4], opt5, "5th item should be 5"); 40 </script> 41 </pre> 42 </body> 43 </html>