Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-view-transitions/navigation/root-element-transition-opt-in-removed-on-old.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>View transitions: basic cross-document navigation opt-in removed</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/">
<link rel="author" href="mailto:khushalsagar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="vt-style">
@view-transition { navigation: auto; }
</style>
<style>
html {
background: blue;
}
.hidden {
width: 10px;
height: 10px;
view-transition-name: hidden;
background: green;
contain: layout;
}
</style>
<script>
const params = new URLSearchParams(location.search);
switch (params.get("mode") || "test") {
case "test":
promise_test(async t => {
const result = await new Promise(resolve => {
window.did_reveal = msg => { resolve(msg) };
const popup = window.open("?mode=old");
t.add_cleanup(() => popup.close());
});
assert_equals(result, "pass");
});
break;
case "old":
onload = () => requestAnimationFrame(() => requestAnimationFrame(() => {
document.querySelector("#vt-style").remove();
location.replace("?mode=new");
}));
break;
case "new":
onpagereveal = (e) => {
window.opener.did_reveal(e.viewTransition ? "fail: have a vt" : "pass");
};
}
</script>
<body>
<div class="hidden"></div>
</body>