blob: 7e89a5ad428f69b04d21d1ba7dbd56a8d06ff988 [file] [log] [blame]
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1422275">
<link rel=help href="https://chromium-review.googlesource.com/c/chromium/src/+/5441435/1#message-cd8841d92a672a0276ab536dfaf3a20e93d5e6e3">
<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, 2, 'select.options.length');
assert_equals(select.options[0], o1, 'select.options[0]');
assert_equals(select.options[1], o2, 'select.options[1]');
}, 'Nested <options> 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>