| <p>This test that setting HTMLSelectElement.length is capped to 100,000, and you can't add additional Option elements too.</p> |
| <div id="console"></div> |
| <select id="theSelect"></select> |
| <script src="../../resources/js-test.js"></script> |
| <script> |
| var sel = document.getElementById('theSelect'); |
| shouldBe('sel.length', '0'); |
| |
| debug('Trying: - sel.length = 100001;'); |
| sel.length = 100001; |
| shouldBe('sel.length', '0'); |
| |
| debug('Trying: - sel.add(new Option, 0);'); |
| sel.add(new Option, 0); |
| shouldBe('sel.length', '1'); |
| |
| debug('Trying: - sel.length = 0;'); |
| sel.length = 0; |
| shouldBe('sel.length', '0'); |
| |
| debug('Index setter:'); |
| shouldBe('sel[100001] = new Option(); sel.length', '0'); |
| shouldBe('sel.options[100001] = new Option(); sel.length', '0'); |
| </script> |