Post

Hey! Thanks for covering Declarative Partial Updates! The reason we use Processing Instructions (<?marker>, <?start>, and <?end>) rather than HTML elements is to allow you to insert content without breaking existing HTML. For example, if you wanted to optionally add new row(s) (<tr>) to a table.

If you used a <div> or <span> then you’d nest the contents. Which would break the DOM structure (like in this table example). Or if you used <tr> in this example, you could only insert one row. Or have to really mangled the DOM which is not good!

Earlier iterations DID use HTML nodes btw but we switched to these Processing Instructions to support these use cases. It’s does look a little weird at first I’ll admit, especially for PHP developers, but these exist in XML (developer.mozilla.org/en-US/docs/W...) — we’ve just brought them to HTML!

developer.mozilla.orgProcessingInstruction - Web APIs | MDNThe ProcessingInstruction interface represents a processing instruction; that is, a Node which embeds an instruction targeting a specific application but that can be ignored by any other applications ...

@davatron5000.bsky.social for HTML templating in the browser, I think you're looking for XSLT 👀 Browsers finally killed off the Space Jam-era 1.0 spec but refused to consider implementing v3 ✅ HTML-based templates ✅ if/else syntax ✅ for loops ✅ "HTML" imports with XSLT template imports

What's even more interesting to me, with XSLT we wouldn't need MCP at all for a lot of use cases XML can be typed with schemas and supported actions are discoverable just like any old anchor tag We could ship data as XML and browsers render HTML which LLMs just parse the raw XML