Declarative Partial Updates

Out-of-order HTML streaming

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>

<?start> / <?end>

Loading range…

Repeated patches

Each template leaves a new marker, so the next template appends instead of overwriting.

Interleaved patches

Loading results…

Inside a table

Kept row

Document title

Tab title after parse:

Stream another patch

setHTML and innerHTML parse into a fragment, so a <template for> inserted that way cannot patch this list. Streaming into the document can.