tor-browser

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

sticky-descendant-move.html (1050B)


      1 <!DOCTYPE html>
      2 <title>Layout Instability: movement of descendant of sticky positioned</title>
      3 <link rel="help" href="https://wicg.github.io/layout-instability/" />
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="resources/util.js"></script>
      7 <div style="position: sticky; width: 400px; height: 300px; top: 0">
      8  <div id="child" style="position: relative; width: 300px; height: 200px; background: yellow"></div>
      9 </div>
     10 <script>
     11 promise_test(async () => {
     12  const watcher = new ScoreWatcher;
     13 
     14  // Wait for the initial render to complete.
     15  await waitForAnimationFrames(2);
     16 
     17  // Modify the position of the div.
     18  const child = document.querySelector("#child");
     19  child.style.top = '100px';
     20 
     21  const expectedScore = computeExpectedScore(300 * (200 + 100), 100);
     22 
     23  // Observer fires after the frame is painted.
     24  assert_equals(watcher.score, 0);
     25  await watcher.promise;
     26  assert_equals(watcher.score, expectedScore);
     27 }, 'Movement of descendant of sticky positioned.');
     28 
     29 </script>