Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/document-metadata/the-link-element/link-load-event-alt-001.html - WPT Dashboard Interop Dashboard
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
async_test(function (t) {
let reached_end = false;
// This ongoing load is needed to trigger the deferral codepath.
{
const ongoing = document.createElement("link");
ongoing.rel = "stylesheet";
ongoing.href = "style.css?link-load-event-alt";
ongoing.onerror = t.unreached_func("Shouldn't error");
document.head.appendChild(ongoing);
}
const alt = document.createElement("link");
alt.rel = "alternate stylesheet";
alt.title = "alt";
alt.href = BAD;
alt.onerror = t.step_func_done(() => {
assert_true(reached_end, "Shouldn't fire error event synchronously");
});
alt.onload = t.unreached_func("Should not load");
document.head.appendChild(alt);
const s = document.createElement("style");
s.textContent = '@import url("' + BAD + '");';
document.head.appendChild(s);
reached_end = true;
});
</script>