opacity-zero.html (1055B)
1 <!DOCTYPE html> 2 <title>Layout Instability: opacity:0</title> 3 <link rel="help" href="https://wicg.github.io/layout-instability/" /> 4 <div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; opacity: 0; background: blue"> 5 <div id="child" style="position: relative; top: 0; width: 200px; height: 200px; opacity: 0.5; background: yellow"></div> 6 </div> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="resources/util.js"></script> 10 <script> 11 12 promise_test(async () => { 13 const watcher = new ScoreWatcher; 14 15 // Wait for the initial render to complete. 16 await waitForAnimationFrames(2); 17 18 // Shift target, for which no shift should be reported because it's not visible. 19 target.style.top = '200px'; 20 21 await waitForAnimationFrames(2); 22 assert_equals(watcher.score, 0); 23 24 // Shift child, for which no shift should be reported, either. 25 child.style.top = '100px'; 26 27 await waitForAnimationFrames(2); 28 assert_equals(watcher.score, 0); 29 }, 'opacity:0'); 30 31 </script>