Skip to content

Commit 28fcb18

Browse files
committed
Add Prior Art section detailing ESI, h-include, HTMX, and Turbo Frames
1 parent 9731a72 commit 28fcb18

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

fragment-include-explainer.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,24 @@ This leaves it up to the author to make sure relative paths in an included fragm
179179
The "module-ness" of this is similar to text or JSON modules, where the content is in the module tree and fetched like a module, but is not mutable in a way that affects all of its importers. In JS, you can do:
180180
`import fragment from "something.html" { type: "fragment" }` which returns a cloned, sanitized `DocumentFragment`.
181181

182+
## Prior Art & Considerations Not Tackled
183+
184+
### 1. Server-Side and Edge Includes
185+
- **SSI (Server-Side Includes):** E.g. `<!--#include virtual="/header.html" -->`. Standard synchronous markup inclusion compiled server-side.
186+
- **ESI (Edge-Side Includes):** E.g. `<esi:include src="http://example.com/header.html" />`. CDN-level edge assembly.
187+
- *Considerations Not Tackled:* ESI features complex caching parameters (`max-age`), conditional routing via `<esi:choose>`, and edge-side variable interpolation. Our proposal delegates caching entirely to HTTP caching headers, and does not provide template conditional syntax.
188+
189+
### 2. Client-Side Userland Libraries
190+
- **`h-include` (Gustaf Nilsson Kotte):** A popular custom element `<h-include src="...">` fetching external HTML and injecting it.
191+
- *Considerations Not Tackled:* `h-include` supports extracting a specific DOM subtree from the response using a CSS selector (e.g. `src="page.html" select="#main-content"`). While powerful, this requires parsing the entire document and discarding most of it. Our proposal targets pure raw fragments to optimize network payload and parsing overhead.
192+
- **HTMX (`hx-get="..." hx-trigger="load"`):** Extends standard elements with declarative AJAX.
193+
- *Considerations Not Tackled:* HTMX supports rich event-driven execution triggers (hover, click, scroll, form updates) and dynamic HTTP response header processing. Our proposal focuses solely on loading subresources as part of standard HTML parser initialization/layout updates.
194+
- **Turbo Frames (`<turbo-frame src="...">`):** Part of Hotwire, isolates page sub-regions for partial navigation.
195+
- *Considerations Not Tackled:* Turbo Frames intercept form submissions and link clicks inside the frame to hijack browser navigation. Our proposal is a layout and include primitive, not a navigation routing engine.
196+
182197
## Alternatives considered
183198

199+
184200
### 1. Introducing a bespoke `<fragment>` element
185201
An alternative is introducing a new bespoke element specifically for in-place or targeted updates, e.g. `<fragment src="fragment.html">` or `<fragment>Inline</fragment>`.
186202

0 commit comments

Comments
 (0)