OLD | NEW |
1 <p>This test that setting HTMLSelectElement.length is capped to 2,147,483,647, a
nd you can't add additional Option elements too.</p> | 1 <p>This test that setting HTMLSelectElement.length is capped to 2,147,483,647, a
nd you can't add additional Option elements too.</p> |
2 <div id="console"></div> | 2 <div id="console"></div> |
3 <select id="theSelect"></select> | 3 <select id="theSelect"></select> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 var sel = document.getElementById('theSelect'); | 6 var sel = document.getElementById('theSelect'); |
7 shouldBe('sel.length', '0'); | 7 shouldBe('sel.length', '0'); |
8 | 8 |
9 debug('Trying: - sel.length = 2147483648;'); | 9 debug('Trying: - sel.length = 2147483648;'); |
10 sel.length = 2147483648; | 10 sel.length = 2147483648; |
11 shouldBe('sel.length', '0'); | 11 shouldBe('sel.length', '0'); |
12 | 12 |
13 debug('Trying: - sel.add(new Option, 0);'); | 13 debug('Trying: - sel.add(new Option, 0);'); |
14 sel.add(new Option, 0); | 14 sel.add(new Option, 0); |
15 shouldBe('sel.length', '1'); | 15 shouldBe('sel.length', '1'); |
16 | 16 |
17 debug('Trying: - sel.length = 0;'); | 17 debug('Trying: - sel.length = 0;'); |
18 sel.length = 0; | 18 sel.length = 0; |
19 shouldBe('sel.length', '0'); | 19 shouldBe('sel.length', '0'); |
20 | 20 |
21 debug('Index setter:'); | 21 debug('Index setter:'); |
22 shouldBe('sel[2147483648] = new Option(); sel.length', '0'); | 22 shouldBe('sel[2147483648] = new Option(); sel.length', '0'); |
23 shouldBe('sel.options[2147483648] = new Option(); sel.length', '0'); | 23 shouldBe('sel.options[2147483648] = new Option(); sel.length', '0'); |
24 </script> | 24 </script> |
OLD | NEW |