old-content-is-empty-div.html (1659B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <title>View transitions: old content captures an empty div</title> 4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/"> 5 <link rel="author" href="mailto:vmpstr@chromium.org"> 6 <link rel="match" href="old-content-is-empty-div-ref.html"> 7 8 <script src="/common/reftest-wait.js"></script> 9 <style> 10 div { 11 contain: paint; 12 width: 100px; 13 height: 100px; 14 position: absolute; 15 top: 50px; 16 } 17 #empty { 18 left: 50px; 19 } 20 #target { 21 left: 200px; 22 background: green; 23 } 24 #hidden { 25 background: red; 26 } 27 28 html::view-transition-group(hidden) { animation-duration: 300s; } 29 html::view-transition-image-pair(hidden) { animation: unset; opacity: 0; } 30 31 /* The effect of the following should be position at the outgoing element 32 but contents of the new element. 33 */ 34 html::view-transition-group(shared) { animation-delay: 100s; } 35 html::view-transition-new(shared) { animation: unset; opacity: 1; } 36 html::view-transition-old(shared) { animation: unset; opacity: 1; } 37 38 html::view-transition-group(root) { animation: unset; opacity: 0; } 39 html::view-transition { background: lightpink; } 40 41 </style> 42 43 <div id=empty></div> 44 <div id=target></div> 45 <div id=hidden></div> 46 47 <script> 48 failIfNot(document.startViewTransition, "Missing document.startViewTransition"); 49 50 async function runTest() { 51 empty.style.viewTransitionName = "shared"; 52 document.startViewTransition(() => { 53 empty.style.viewTransitionName = ""; 54 target.style.viewTransitionName = "shared"; 55 56 requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)) 57 }); 58 } 59 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); 60 </script>