tor-browser

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

auto-expand-details-element-fragment.html (959B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
      3 <link rel="help" href="https://github.com/whatwg/html/pull/6466">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <div style="height:2000px">spacer</div>
      8 
      9 <details id=details>
     10  <div id=target>target</div>
     11 </details>
     12 
     13 <script>
     14 async_test(t => {
     15  assert_false(details.hasAttribute('open'),
     16    `The <details> should be closed at the start of the test.`);
     17  assert_equals(window.pageYOffset, 0,
     18    `The page should be scrolled to the top at the start of the test.`);
     19 
     20  window.location.hash = '#target';
     21 
     22  requestAnimationFrame(t.step_func_done(() => {
     23    assert_true(details.hasAttribute('open'),
     24      `<details> should be opened by navigating to an element inside it.`);
     25    assert_not_equals(window.pageYOffset, 0,
     26      `The page should be scrolled down to the <details> element.`);
     27  }));
     28 });
     29 </script>