# One UI, Many Back-Ends: Out-of-Order HTML Streaming in AutoCSS

> Source: <https://gist.github.com/dragontheory/469f31a4a1085211011810faf2e1052e>
> Published: 2026-12-01 04:34:43+00:00

**Key takeaway:** Using declarative <template for> patches with named start/end markers lets the browser place streamed HTML out of order without JavaScript, cutting data-mapping JS by about 87% in a headless Chrome 158 test.

Nov 30, 2026 · @D7460N

**AutoCSS** keeps the presentation layer air-gapped from the data layer, so one modern, secure, fully W3C/WCAG Standards and 508 A11Y compliant UI can render and adapt to, and control many various back-ends.

*Out-of-order HTML streaming* lets the browser itself place delivered HTML into that UI, which moves more of the UI to one security approved CDN-served source.

**AutoCSS** canon states the aim: "not one project's UI but every project's at once — one presentation layer, served once, called remotely to render any back-end's data by that data's presence and shape alone" ([AGENTS.md §1](https://github.com/D7460N-ai/D7460N.ai/blob/main/AGENTS.md)).

| Layer | Owns | Never holds | 
|---|---|---|
| HTML | Semantic and HTML5 custom elements: structure only | Classes, ids, `data-*` , CSS, JS | 
| CSS | Look/feel, state, visibility by data presence ( `:not(:empty);` ,```:has()``;``` , container and style queries,``` light-dark()``;``` ) | Data, JS | 
| JS | Data transport (CRUD) through one `oninput` | Presentation, HTML | 
| Data (JSON today) | Values only | HTML, styling hints | 

Because CSS reacts live in real-time to whatever arrives, the UI does not need to know which back-end sent it. That is the "one UI for many back-ends" goal.

Patching lets HTML arrive in any order and land in named spots in the page; the browser does the placing, not JS ([article](https://itnext.io/how-out-of-order-streaming-html-will-revolutionize-the-web-4978800b44af), [Chrome blog](https://developer.chrome.com/blog/declarative-partial-updates)).

```
<h1><?start name="h1">Loading…<?end></h1>

<template for="h1">Home</template>
```

| Part | What it does | Shipped | 
|---|---|---|
| `<?start name>` …`<?end>` ,`<?marker name>` | Named spots (processing instructions, formerly parsed as comments) | Chrome/Edge 150 ( [webstatus](https://webstatus.dev/features/template-for) ) | 
| `<template for="name">` | Replaces the named spot with its content; no JS | Chrome/Edge 150 | 
| `<template for="name" src="url">` | Fetches the content from a URL; no JS | Experimental flag only | 
| `streamAppendHTMLUnsafe()` and other streaming setters | JS streams fetched HTML; its `<template for>` patches apply | Chrome/Edge 157 ( [webstatus](https://webstatus.dev/features/html-streaming-setters) ) | 

A patch can carry new markers, so the same spot can be filled again. The article's single-page demo uses that to swap page content on each navigation ([live demo](https://streaming-spa.vercel.app/)). The safe `streamAppendHTML()` drops the templates, so the demo uses the `Unsafe` variant.

Firefox and Safari have not shipped it. WebKit's position is "support" ([#628](https://github.com/WebKit/standards-positions/issues/628)) and Mozilla's is "positive" ([#1369](https://github.com/mozilla/standards-positions/issues/1369)). An earlier no-JS approach used Declarative Shadow DOM and `<slot>` ([lamplightdev](https://lamplightdev.com/blog/2024/01/10/streaming-html-out-of-order-without-javascript/)); AutoCSS bans both.

The CDN would carry everything shared, shell and CSS; each back-end would send only content, which the browser places and CSS reveals.

[embedded content: AutoCSS delivery map · CDN, back-ends, 4 page steps]

Steps 1 to 4 run the same way on every site; only the content in step 3 differs per back-end. The CDN shell is a ruling; the generator's location is open.

In headless Chrome 158, patching filled an AutoCSS-shaped page through load, view switch and back, and cut the data-mapping JS by about 87%.

| Test | Result | 
|---|---|
| `<template for>` fills a named spot | ✅ No JS; markers and template removed after | 
| `:empty` on an element holding only markers | ✅ True, so the CSS loader logic is unchanged | 
| Patch placed inside the `<template>` pool | ❌ Never applies; template content is inert | 
| `<template for src>` | ⚠️ Flag only; normal Chrome ignores `src` and wipes the placeholder | 
| One patch file fills many spots | ✅ Limited to the target's container; a patch aimed at `header` from`main` was blocked | 
| View switch: load, switch, back | ✅ Lists went 5 → 2 → 5 items; nav radios inside labels survived | 
| One spot takes a different layout per view | ✅ `p` +`p` +`ul` ↔`figure` +`p` ,`index.html` unchanged | 
| Outer shell from another origin (CORS) | ✅ Flag on: no JS, rendered with JS off. Normal Chrome: JS fallback | 
| JSON as a patch source | ❌ Never mapped; rejected or dumped as raw text | 
| Data-mapping JS in the reference app | 3 files, 3,631 bytes → 1 file, 458 bytes | 
| `contentEditable` on a filled spot | ✅ Markers survived editing | 

The method works today only in Chrome and Edge, and its data must be HTML, not JSON.

| Area | Finding | Status | 
|---|---|---|
| Browsers | Chrome/Edge only; `<template for src>` still behind a flag | Waiting on Firefox, Safari and the `src` launch | 
| Data format | Patch files are HTML. JSON needs JS or a generator outside the page; the canon (§6) says data is JSON | Open ruling | 
| Security | `Unsafe` without a sanitizer ran an`onerror` handler and let a`<style>` restyle the page. An allowlist Sanitizer stripped both but kept a`javascript:` link. A CDN shell`<script>` ran on the`src` path | Allowlist sanitizer + CSP; shell file holds no `<script>` | 
| Attributes | `src` /`alt` cannot be patched onto existing elements; the data carries the whole`<img>` | Open | 
| Frameworks | JSX errors on markers; Vue errors and drops them; Angular drops them silently. AutoCSS CSS is unaffected | Framework apps keep their own data binding | 
| Failure | A failed CDN fetch left a blank page | Pin with `integrity` , render-block with`<link rel="expect">` (untested) | 
| Fallback cost | A conditional `import()` keeps fallback code off supporting browsers, but hook J3 blocks it | Open ruling | 

Two rulings are recorded (Nov 30, 2026); the matching canon edits are drafted but not committed.

- Central control of the outer shell from the CDN is better than per-site `index.html` ; the per-site HTML-contract rule is removed.
- Loading HTML through JS is loosened for the shell: `<template for src>` first, a JS fallback only where it is unsupported.

-  Commit canon edits: `AGENTS.md` §5 and §9,`WHITELIST.md` J,`enforce.js` ,`rules.json`
-  Architecture Test 5: original-vs-proposed screenshots and benchmark against `inject.js`
- Rule on data format: HTML patch files, or JSON plus a generator
- Find and test a Firefox and Safari path

- [How Out-Of-Order Streaming HTML Will Revolutionize The Web](https://itnext.io/how-out-of-order-streaming-html-will-revolutionize-the-web-4978800b44af) , Danny Moerkerke, ITNEXT, Nov 30, 2026
- [Streaming SPA live demo](https://streaming-spa.vercel.app/) and[source](https://github.com/DannyMoerkerke/streaming-spa)
- [Declarative partial updates](https://developer.chrome.com/blog/declarative-partial-updates) , Chrome for Developers, and its[photo album demo source](https://github.com/GoogleChromeLabs/web-perf-demos/blob/main/patching-demos/photo-album-server.js)
- [WICG Declarative Partial Updates](https://github.com/WICG/declarative-partial-updates) :[patching explainer](https://github.com/WICG/declarative-partial-updates/blob/main/patching-explainer.md) ,[fragment include explainer](https://github.com/WICG/declarative-partial-updates/blob/main/fragment-include-explainer.md)
- webstatus.dev: [`<template for>`](https://webstatus.dev/features/template-for) ,[HTML streaming setters](https://webstatus.dev/features/html-streaming-setters)
- Standards positions: [WebKit #628](https://github.com/WebKit/standards-positions/issues/628) ,[Mozilla #1369](https://github.com/mozilla/standards-positions/issues/1369)
- [Out-of-Order HTML Streaming](https://developer.chrome.com/docs/modern-web-guidance/guides/performance/out-of-order-html-streaming) , Modern Web Guidance
- [Streaming HTML out of order without JavaScript](https://lamplightdev.com/blog/2024/01/10/streaming-html-out-of-order-without-javascript/) , lamplightdev
- [AGENTS.md](https://github.com/D7460N-ai/D7460N.ai/blob/main/AGENTS.md) , AutoCSS canon, and the[AutoCSS CDN](https://autocss-com.github.io/cdn/)
