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/outer-padding-inner-background.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class=reftest-wait>
<title>View transitions: named element has padding, inner element has background</title>
<link rel="match" href="outer-padding-inner-background-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
:root { view-transition-name: none; }
::view-transition { background: rebeccapurple; }
.target {
width: 200px;
height: 200px;
view-transition-name: target;
padding: 20px;
}
.child {
width: 100px;
height: 100px;
position: relative;
background: green;
}
html::view-transition-group(target) {
animation-play-state: paused;
}
html::view-transition-old(target),
html::view-transition-new(target) {
animation: unset;
opacity: 1;
}
html::view-transition-new(target) {
position: relative;
top: 100px;
}
/* None of these should apply, so make everything red if it does */
html::view-transition-group(root) { animation: unset; opacity: 1; background: red; }
html::view-transition-image-pair(root) { visibility: hidden }
</style>
<div class=target>
<div class=child>
</div>
</div>
<script>
failIfNot(document.startViewTransition, "Missing document.startViewTransition");
async function runTest() {
document.startViewTransition(() =>
requestAnimationFrame(() => requestAnimationFrame(takeScreenshot)));
}
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
</script>