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 ...

0 reposts0 likes

No replies yet.