tor-browser

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

hidden-until-found-text-fragment.html (1319B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>beforematch fired on ScrollToTextFragment</title>
      4 <link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#attr-hidden-until-found">
      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 <script src="/common/utils.js"></script>
     12 <script src="/scroll-to-text-fragment/stash.js"></script>
     13 
     14 <script>
     15 promise_test(t => new Promise((resolve, reject) => {
     16  const key = token();
     17  test_driver.bless('Open a scroll to text fragment URL', () => {
     18    window.open(
     19      `resources/hidden-until-found-text-fragment.html?key=${key}#:~:text=foo`,
     20      '_blank',
     21      'noopener');
     22  });
     23  fetchResults(key, resolve, reject);
     24 }).then(results => {
     25  assert_false(results.targetHasHiddenAttribute,
     26    'The matching hidden=until-found element should have its hidden attribute removed so it can be scrolled to.');
     27  assert_true(results.pageYOffsetAfterRaf > 0,
     28    'The page should be scrolled down to foo.');
     29 }), 'Verifies that the beforematch event is fired on the matching element of a ScrollToTextFragment navigation.');
     30 </script>