| OLD | NEW |
| 1 <p>This test that setting HTMLSelectElement.length is capped to 10,000, but that
you can add additional Option elements by calling add.</p> | 1 <p>This test that setting HTMLSelectElement.length is capped to 10,000, but that
you can add additional Option elements by calling add.</p> |
| 2 <pre id="console"></pre> | 2 <div id="console"></div> |
| 3 <select id="theSelect"></select> | 3 <select id="theSelect"></select> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 <script> |
| 6 var sel = document.getElementById('theSelect'); |
| 7 shouldBe('sel.length', '0'); |
| 4 | 8 |
| 5 <script> | 9 debug('Trying: - sel.length = 20000;'); |
| 6 if (window.testRunner) | 10 sel.length = 20000; |
| 7 testRunner.dumpAsText(); | 11 shouldBe('sel.length', '0'); |
| 8 | 12 |
| 9 function log(msg) | 13 debug('Trying: - sel.add(new Option, 0);'); |
| 10 { | 14 sel.add(new Option, 0); |
| 11 document.getElementById("console").appendChild(document.createTextNode(m
sg + "\n")); | 15 shouldBe('sel.length', '1'); |
| 12 } | |
| 13 | 16 |
| 14 var sel = document.getElementById('theSelect'); | 17 debug('Trying: - sel.length = 0;'); |
| 15 log("Select length is " + sel.length); | 18 sel.length = 0; |
| 19 shouldBe('sel.length', '0'); |
| 16 | 20 |
| 17 log("Trying: - sel.length = 20000;"); | 21 debug('Index setter:'); |
| 18 sel.length = 20000; | 22 shouldBe('sel[20000] = new Option(); sel.length', '0'); |
| 19 log("Select length is " + sel.length); | 23 shouldBe('sel.options[20000] = new Option(); sel.length', '0'); |
| 20 | |
| 21 log("Trying: - sel.add(new Option, 0);"); | |
| 22 sel.add(new Option, 0); | |
| 23 log("Select length is " + sel.length); | |
| 24 | |
| 25 log("Trying: - sel.length = 0;"); | |
| 26 sel.length = 0; | |
| 27 log("Select length is " + sel.length); | |
| 28 </script> | 24 </script> |
| OLD | NEW |