Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-view-transitions/nested-elements-in-overflow.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class=reftest-wait>
<meta name="timeout" content="long">
<title>View transitions: nested named element in overflow</title>
<link rel="author" href="mailto:khushalsagar@chromium.org">
<link rel="match" href="nested-elements-in-overflow-ref.html">
<meta name="fuzzy" content="maxDifference=0-60; totalPixels=0-500">
<script src="/common/reftest-wait.js"></script>
<style>
:root {
view-transition-name: none;
}
.outer {
background: lightblue;
width: 100px;
height: 100px;
view-transition-name: outer;
position: absolute;
top: 50px;
left: 50px;
}
.inner {
background: lightgrey;
position: relative;
top: -50px;
left: -50px;
width: 50px;
height: 50px;
view-transition-name: inner;
}
::view-transition { background: rebeccapurple; }
::view-transition-group(*) {
animation-duration: 300s;
}
::view-transition-group(outer) {
width: 50px;
height: 100px;
border: 2px solid black;
animation: none;
}
::view-transition-new(*),
::view-transition-old(*) {
position: absolute;
inset-block-start: unset;
inline-size: 100%;
block-size: 100%;
object-fit: contain;
}
::view-transition-old(*) {
opacity: 0;
animation: none;
}
::view-transition-new(*) {
opacity: 1;
animation: none;
}
</style>
<div class="outer">
<div class="inner"></div>
</div>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
document.startViewTransition().ready.then(takeScreenshot);
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>