tor-browser

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

same-document-test-sync-load.html (1024B)


      1 <!doctype html>
      2 <title>Same document navigation to text fragment directives before loading the document has finished</title>
      3 <meta charset=utf-8>
      4 <link rel="help" href="https://wicg.github.io/ScrollToTextFragment/">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="resources/util.js"></script>
      8 <script>
      9 // Ensure that a same-document text directive navigation works correctly
     10 // if the navigation is triggered before the page finishes loading.
     11 promise_test(async t => {
     12  assert_implements(document.fragmentDirective, 'Text directive not implemented');
     13 
     14  location.hash = ':~:text=line%20of%20text';
     15  await t.step_wait(() => window.scrollY > 0, "Wait for scroll");
     16  assert_true(isInViewport(document.getElementById('text')), 'Scrolled to text');
     17 }, 'Same-document text directive navigation before loading the document has finished');
     18 </script>
     19 <style>
     20  div {
     21    margin: 200vh 0 200vh 0;
     22  }
     23 </style>
     24 
     25 <div id="text">
     26  This is a line of text.
     27 </div>