test_bug633133.html (1548B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=633133 5 --> 6 <head> 7 <title>Test for Bug 633133</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=633133">Mozilla Bug 633133</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 <div id='foo'></div> 16 <div name='bar'></div> 17 <select id="select" onchange="var foo = 'bar';"> 18 <option>option1</option> 19 <option>option2</option> 20 </select> 21 </div> 22 <pre id="test"> 23 <script type="application/javascript"> 24 25 /** Test for Bug 633133 */ 26 27 var divCollection = document.getElementsByTagName('div'); 28 29 ok("foo" in divCollection, "'foo' should be in the div collection"); 30 ok("bar" in divCollection, "'bar' should be in the div collection"); 31 ok(!("" in divCollection), "empty string shouldn't be in the div collection"); 32 ok(!("foobar" in divCollection), "'foobar' shouldn't be in the div collection"); 33 34 var select = $('select'); 35 is(select[0].text, "option1", "select elements work"); 36 Math.sin(); 37 ok(1 in select, "in works"); 38 is(select[1].text, "option2", "can get it too"); 39 ok(!(2 in select), "in works for elements out of range"); 40 is(select[2], undefined, "can get them too and they're undefined"); 41 isnot(select.onchange, undefined, "select.onchange shouldn't be undefined"); 42 is(typeof(select.onchange), 'function', "select.onchange should be a function"); 43 44 </script> 45 </pre> 46 </body> 47 </html>