Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-images/object-fit-stale-image-while-revalidating.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>CSS Images: object-fit applies to stale image while revalidating</title>
<link rel="author" title="jj" href="mailto:jj@imput.net">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<script src="/common/reftest-wait.js"></script>
<script src="/common/utils.js"></script>
<style>
#target, img { height: 100px; width: 100px }
#target { background: green }
img { display: block; object-fit: cover }
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="target"></div>
<script>
const params = new URLSearchParams(location.search);
const id = params.get("id") || token();
const revalidated = location.search.includes("revalidate");
window.onload = () => {
const image = document.createElement("img");
image.onload = () => revalidated || (location.search = `?id=${id}&revalidate`);
image.src = `support/object-fit-stale-image.py?id=${id}`;
if (!revalidated) {
return;
}
document.getElementById("target").append(image);
takeScreenshot();
}
</script>
</html>