mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #14085 - frewsxcv:list-of-options, r=asajeffrey
Implement "list of options" concept on `HTMLSelectElement`. Fixes #13763. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14085) <!-- Reviewable:end -->
This commit is contained in:
commit
a15d279e9f
3 changed files with 107 additions and 20 deletions
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue