Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Declarative Fragment: removing template cancels fetch</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="container">
<div id="target">
<?start name="marker">Original<?end>
</div>
<template for="marker" buffer
src="/html/dom/partial-updates/tentative/resources/chunked-html.py?delay=300&chunk1=CANCELLED"
id="tpl"></template>
</div>
<script>
queueMicrotask(() => {
const tpl = document.getElementById('tpl');
if (tpl) {
tpl.remove();
}
});
promise_test(async () => {
const container = document.getElementById('target');
// Wait 400ms to verify that the chunk is NOT rendered (since it was cancelled)
await new Promise(resolve => step_timeout(resolve, 400));
assert_false(container.textContent.includes("CANCELLED"), "Target should NOT be updated because the template was removed and fetch was cancelled");
}, "Removing template element cancels ongoing patch fetch");
</script>
</body>