Summary: <template for> replaces a processing-instruction marker that appeared earlier in
the document. <?marker> is an insertion point. <?start> …
<?end> is a range, so a loading placeholder can show until the template is parsed.
Processing instructions are what make this work in <head>, <title>, and
<table>. The title is patched by wrapping the <title> element.
<?…> inside the title text stays text, because the title is RCDATA.
Explainer: patching-explainer.md
Docs: Declarative partial updates | Chrome for Developers
Shipped in Chrome 150. Static examples below are applied by the parser. The last section streams a new
template with streamAppendHTMLUnsafe, which needs
chrome://flags/#enable-experimental-web-platform-features until the insertion methods ship.
=== This is a demo of out-of-order HTML streaming. ===
<?marker> replacement<?start> / <?end> replacement<table><title> patch<?marker><?start> / <?end>Each template leaves a new marker, so the next template appends instead of overwriting.
Result A
Carousel item, streamed between the two result patches.
Result B
| Kept row |
Tab title after parse:
setHTML and innerHTML parse into a fragment, so a
<template for> inserted that way cannot patch this list. Streaming into the document
can.