Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/the-select-element/select-value-option.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<select id=select>
<option id=optone>innertext one</option>
<option id=opttwo value=valueattribute>innertext two</option>
</select>
<style>
select, ::picker(select) {
appearance: base-select;
}
</style>
<script>
test(() => {
assert_equals(select.value, 'innertext one',
'The first option should be selected initially.');
select.value = 'valueattribute';
assert_equals(select.value, 'valueattribute',
'Assigning value should look at the options value, not innertext');
}, 'select.value should reflect option.value');
</script>