web-animations-api-parse-pseudo-argument.html (2322B)
1 <!DOCTYPE html> 2 <html class=reftest-wait> 3 <title>View transitions with web-animation API: full parsing of argument</title> 4 <link rel="help" href="https://www.w3.org/TR/css-view-transitions-1/"> 5 <link rel="match" href="web-animations-api-ref.html"> 6 <meta name="fuzzy" content="maxDifference=0-2; totalPixels=0-500"> 7 <meta name="variant" content="?first-pseudo=::view-transition-group( first)"> 8 <meta name="variant" content="?first-pseudo=::view-transition-group(first)"> 9 <meta name="variant" content="?first-pseudo=::view-transition-group( first"> 10 <meta name="variant" content="?first-pseudo=::view-transition-group( first )"> 11 <meta name="variant" content="?first-pseudo=::view-transition-group(first )"> 12 <meta name="variant" content="?first-pseudo=::view-transition-group(first"> 13 <script src="/common/reftest-wait.js"> 14 </script> 15 <style> 16 #first { 17 background: blue; 18 width: 100px; 19 height: 100px; 20 contain: paint; 21 } 22 23 #second { 24 background: green; 25 width: 100px; 26 height: 100px; 27 contain: paint; 28 } 29 30 /* Unset all animations since the test drives it using WA-API */ 31 html::view-transition-group(*), 32 html::view-transition-image-pair(*), 33 html::view-transition-new(*), 34 html::view-transition-old(*) { 35 animation: unset; 36 } 37 38 html::view-transition-group(root) { 39 opacity: 0; 40 } 41 </style> 42 <div id=first></div> 43 <div id=second></div> 44 <script> 45 failIfNot(document.startViewTransition, "Missing document.startViewTransition"); 46 const firstPseudo = new URL(location.href).searchParams.get("first-pseudo") ?? "::view-transition-group(first)"; 47 48 function setAnimation() { 49 document.documentElement.animate({ transform: ['translate(100px)', 'translate(100px)'] }, { duration: 10000, pseudoElement: firstPseudo }); 50 document.documentElement.animate({ transform: ['translate(150px)', 'translate(150px)'] }, { duration: 10000, pseudoElement: '::view-transition-group(second)' }); 51 requestAnimationFrame(takeScreenshot); 52 } 53 54 async function runTest() { 55 first.style.viewTransitionName = "first"; 56 document.startViewTransition(() => { 57 first.style.viewTransitionName = ""; 58 second.style.viewTransitionName = "second"; 59 requestAnimationFrame(setAnimation); 60 }); 61 } 62 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest)); 63 </script>