summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/nested-options.tenative.html
blob: 7e89a5ad428f69b04d21d1ba7dbd56a8d06ff988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!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>