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:
- /html/semantics/embedded-content/the-img-element/image-loading-lazy-in-scroller-nested-2.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#scroller {
width: 100px;
height: 100px;
overflow: scroll;
background-color: gray;
}
#scroller2 {
width: 110px;
height: 110px;
overflow: scroll;
}
#spacer {
width: 130px;
height: 130px;
}
#target {
width: 100px;
height: 100px;
}
</style>
<div id=scroller2>
<div id="spacer"></div>
<div id="scroller">
<img
id="target"
src="resources/green.png"
loading="lazy"
onload="img_onload();"
>
</div>
</div>
<script>
const t = async_test(
"Test that lazy-loaded images load when near viewport."
);
function img_onload() {
t.done();
}
t.step_timeout(() => {
t.unreached_func(
"Timed out while waiting for image to load."
)();
}, 2000);
</script>