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/img-complete-after-error.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>An image is complete after a 404 error</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";
async_test(t => {
const img = document.createElement("img");
img.src = "file-does-not-exist.png";
assert_false(img.complete);
img.onload = img.onerror = t.step_func_done(event => {
assert_equals(event.type, "error");
assert_true(img.complete);
});
}, "src 404 error");
</script>