Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement "list of options" concept on
HTMLSelectElement
.
Fixes #13763.
- Loading branch information
Showing
3 changed files
with
107 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
tests/wpt/web-platform-tests/html/semantics/forms/the-select-element/select-value.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>HTMLSelectElement.value</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-select-value"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id=log></div> | ||
|
||
<select id=sel1> | ||
<option value=0></option> | ||
<option selected value=1></option> | ||
</select> | ||
|
||
<select id=sel2> | ||
<optgroup> | ||
<option value=0></option> | ||
</optgroup> | ||
<optgroup></optgroup> | ||
<optgroup> | ||
<option></option> | ||
<option value=1></option> | ||
<option selected value=2></option> | ||
</optgroup> | ||
</select> | ||
|
||
<select id=sel3> | ||
<option selected value=1></option> | ||
</select> | ||
|
||
<select id=sel4></select> | ||
|
||
<script> | ||
test(function() { | ||
var select = document.getElementById('sel1'); | ||
assert_equals(select.value, '1'); | ||
}, 'options'); | ||
|
||
test(function() { | ||
var select = document.getElementById('sel2'); | ||
assert_equals(select.value, '2'); | ||
}, 'optgroups'); | ||
|
||
test(function() { | ||
var select = document.getElementById('sel3'); | ||
var option = select.options[0]; | ||
var div = document.createElement('div'); | ||
select.appendChild(div); | ||
div.appendChild(option); | ||
assert_equals(select.value, ''); | ||
}, 'option is child of div'); | ||
|
||
test(function() { | ||
var select = document.getElementById('sel4'); | ||
assert_equals(select.value, ''); | ||
}, 'no options'); | ||
</script> |