Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-img-element/delay-load-event-detached.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Detached image blocks load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
var img_loaded = false;
var img = new Image();
img.onload = function() {
img_loaded = true;
};
img.src = "/images/blue.png?pipe=trickle(d2)";
test(function() {
assert_false(img_loaded);
}, "setting img.src is async");
async_test(function(t) {
document.addEventListener("DOMContentLoaded", t.step_func_done(function() {
assert_false(img_loaded);
}));
}, "DOMContentLoaded doesn't wait for images");
async_test(function(t) {
window.addEventListener("load", t.step_func_done(function() {
assert_true(img_loaded);
}));
}, "load waits for images");
</script>