summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/the-hidden-attribute/resources/hidden-until-found-text-fragment.html
blob: fe89b407e654a7b7abbb98dcf4edf1a3d8f64721 (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
<!DOCTYPE html>
<script src="/scroll-to-text-fragment/stash.js"></script>

<!-- This test is navigated to with the fragment #:~:text=foo -->

<body>
  <div style="height: 4000px;">spacer</div>
  <div id=target hidden=until-found>foo</div>
  <script>
    requestAnimationFrame(() => {
      requestAnimationFrame(() => {
        const results = {};
        // This should be false. The hidden=until-found attribute should be
        // removed in response to ScrollToTextFragment.
        results.targetHasHiddenAttribute = document.getElementById('target').hasAttribute('hidden');
        // This should be greater than zero. The page should be scrolled down
        // to foo.
        results.pageYOffsetAfterRaf = window.pageYOffset;

        params = new URLSearchParams(window.location.search);
        stashResultsThenClose(params.get('key'), results);
      });
    });
  </script>
</body>