Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<select>
<datalist>
<option id=o1>
parent
<option id=o2>child</option>
</option>
</datalist>
</select>
<script>
const select = document.querySelector('select');
test(() => {
assert_equals(select.innerHTML, `
<datalist>
<option id="o1">
parent
</option><option id="o2">child</option>
</datalist>
`);
}, 'The HTML parser should disallow nested options in select datalist.');
// Manually nest the <options> anyway for the following tests.
o1.appendChild(o2);
test(() => {
assert_equals(select.options.length, 1, 'select.options.length');
assert_equals(select.options[0], o1, 'select.options[0]');
}, 'Nested <options> not should be listed in <select> IDLs.');
promise_test(async () => {
await test_driver.bless();
select.showPicker();
}, 'Showing the popup with nested <option>s should not crash.');
</script>