test_rowscollection.html (1771B)
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 <table id="f"> 17 <thead> 18 <tr id="x"></tr> 19 </thead> 20 <tfoot> 21 <tr id="z"></tr> 22 <tr id="w"></tr> 23 </tfoot> 24 <tr id="x"></tr> 25 <tr id="y"></tr> 26 <tbody> 27 <tr id="z"></tr> 28 </tbody> 29 </table> 30 </div> 31 <pre id="test"> 32 <script type="application/javascript"> 33 34 /** Test for Bug 772869 */ 35 var x = $("f").rows; 36 x.something = "another"; 37 var names = []; 38 for (var name in x) { 39 names.push(name); 40 } 41 is(names.length, 10, "Should have 10 enumerated names"); 42 is(names[0], "0", "Enum entry 1") 43 is(names[1], "1", "Enum entry 2") 44 is(names[2], "2", "Enum entry 3") 45 is(names[3], "3", "Enum entry 4") 46 is(names[4], "4", "Enum entry 5") 47 is(names[5], "5", "Enum entry 6") 48 is(names[6], "something", "Enum entry 7") 49 is(names[7], "item", "Enum entry 8") 50 is(names[8], "namedItem", "Enum entry 9") 51 is(names[9], "length", "Enum entry 10"); 52 53 names = Object.getOwnPropertyNames(x); 54 is(names.length, 11, "Should have 11 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], "5", "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], "w", "Entry 10") 65 is(names[10], "something", "Entry 11") 66 </script> 67 </pre> 68 </body> 69 </html>