add-remove-position-sticky.html (865B)
1 <!DOCTYPE html> 2 <title>Layout Instability: no shift for adding/removing position:sticky</title> 3 <link rel="help" href="https://wicg.github.io/layout-instability/" /> 4 <div id="target" style="width: 100px; height: 100px; background: green"></div> 5 <div style="height: 2000px"></div> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="resources/util.js"></script> 9 <script> 10 11 promise_test(async () => { 12 const watcher = new ScoreWatcher; 13 14 // Wait for the initial render to complete. 15 await waitForAnimationFrames(2); 16 17 target.style.position = 'sticky'; 18 19 await waitForAnimationFrames(3); 20 assert_equals(watcher.score, 0); 21 22 target.style.position = 'static'; 23 24 await waitForAnimationFrames(3); 25 assert_equals(watcher.score, 0); 26 }, "No shift for adding/removing position:sticky."); 27 28 </script>