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/transformed-element-scroll-transform.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html style="reftest-wait">
<head>
<title>Scroll position transform should be the last one to be applied</title>
<link rel="match" href="transformed-element-scroll-transform-ref.html">
<style>
:root {
view-transition-name: none;
}
::view-transition-group(*) {
animation-duration: 10s;
}
#target {
width: 100px;
height: 100px;
background: green;
margin: 300px;
view-transition-name: target;
rotate: 90deg;
}
</style>
</head>
<body>
<div id="target"></div>
<div style="height: 1000px"></div>
<script>
function scrollBy(y) {
return new Promise(resolve => {
addEventListener("scroll", () => {
requestAnimationFrame(() => {
requestAnimationFrame(resolve);
});
}, { once: true, capture: true });
document.documentElement.scrollBy({
top: y,
behavior: "instant"
});
});
}
addEventListener("load", async () => {
await scrollBy(200);
const transition = document.startViewTransition();
await transition.ready;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.classList.remove("reftest-wait");
});
});
});
</script>
</body>
</html>