| <!DOCTYPE html> |
| <body> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <div id="log"></div> |
| <select> |
| <option>Unselected</option> |
| <option selected>Selected</option> |
| </option> |
| </select> |
| <select> |
| <option>Unselected</option> |
| <option selected>Selected</option> |
| </option> |
| </select> |
| <script> |
| // This is a supplemenetal test for web-platform-tests/html/semantics/forms/the-option-element/option-selected.html |
| |
| test(function() { |
| var unselected = document.querySelectorAll('select')[0].options[0]; |
| unselected.selected = false; |
| unselected.setAttribute('selected', 'selected'); |
| assert_true(unselected.selected); |
| |
| var selected = document.querySelectorAll('select')[1].options[1]; |
| selected.selected = true; |
| selected.removeAttribute('selected'); |
| assert_false(selected.selected); |
| }, '|selected| setter should not make an option dirty if it doesn\'t change its selectedness and the option is owned by a select element'); |
| </script> |
| </body> |