tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nested-options.html (1460B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:jarhar@chromium.org">
      3 <link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1422275">
      4 <link rel=help href="https://chromium-review.googlesource.com/c/chromium/src/+/5441435/1#message-cd8841d92a672a0276ab536dfaf3a20e93d5e6e3">
      5 <link rel=help href="https://issues.chromium.org/issues/376786406">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="/resources/testdriver.js"></script>
      9 <script src="/resources/testdriver-vendor.js"></script>
     10 
     11 <select>
     12  <datalist>
     13    <option id=o1>
     14      parent
     15      <option id=o2>child</option>
     16 </option>
     17  </datalist>
     18 </select>
     19 
     20 <script>
     21 const select = document.querySelector('select');
     22 
     23 test(() => {
     24  assert_equals(select.innerHTML, `
     25  <datalist>
     26    <option id="o1">
     27      parent
     28      </option><option id="o2">child</option>
     29 
     30  </datalist>
     31 `);
     32 }, 'The HTML parser should disallow nested options in select datalist.');
     33 
     34 // Manually nest the <options> anyway for the following tests.
     35 o1.appendChild(o2);
     36 select.appendChild(o1);
     37 
     38 test(() => {
     39  assert_equals(select.options.length, 1, 'select.options.length');
     40  assert_equals(select.options[0], o1, 'select.options[0]');
     41 }, 'Nested <options> not should be listed in <select> IDLs.');
     42 
     43 promise_test(async () => {
     44  await test_driver.bless();
     45  select.showPicker();
     46 }, 'Showing the popup with nested <option>s should not crash.');
     47 </script>