| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <body> | 2 <body> |
| 3 <script src="../../../resources/testharness.js"></script> | 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> | 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#ask-for
-a-reset"> | 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#ask-for
-a-reset"> |
| 6 <div id="log"></div> | 6 <div id="log"></div> |
| 7 <script> | 7 <script> |
| 8 test(function() { | 8 test(function() { |
| 9 var select = document.createElement('select'); | 9 var select = document.createElement('select'); |
| 10 select.innerHTML = '<option>foo</option>'; | 10 select.innerHTML = '<option>foo</option>'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 test(function() { | 33 test(function() { |
| 34 var form = document.createElement('form'); | 34 var form = document.createElement('form'); |
| 35 document.body.appendChild(form); | 35 document.body.appendChild(form); |
| 36 var select = document.createElement('select'); | 36 var select = document.createElement('select'); |
| 37 form.appendChild(select); | 37 form.appendChild(select); |
| 38 select.innerHTML = '<option disabled>Apple</option><option>Banana</option><o
ption>Cherry</option>'; | 38 select.innerHTML = '<option disabled>Apple</option><option>Banana</option><o
ption>Cherry</option>'; |
| 39 assert_equals(select.selectedIndex, 1); | 39 assert_equals(select.selectedIndex, 1); |
| 40 form.reset(); | 40 form.reset(); |
| 41 assert_equals(select.selectedIndex, 1); | 41 assert_equals(select.selectedIndex, 1); |
| 42 }, 'Reset should select the first option element in the list of options that is
not disabled to true'); | 42 }, 'Reset should select the first option element in the list of options that is
not disabled to true'); |
| 43 |
| 44 test(function() { |
| 45 var select = document.createElement('select'); |
| 46 select.innerHTML = '<option>foo</option><option>bar</option>'; |
| 47 document.body.appendChild(select); |
| 48 select.selectedIndex = -1; |
| 49 select.removeChild(select.lastChild); |
| 50 assert_equals(select.selectedIndex, 0); |
| 51 }, 'Removing an OPTION from a SELECT element should reset selection.'); |
| 43 </script> | 52 </script> |
| 44 </body> | 53 </body> |
| OLD | NEW |