2 hours ago · 7 min read1419 words · Tech · hide · 0 comments

There’s a new web platform feature flighting in Chromium called Declarative Partial Updates. This proposal adds a new <?marker> element which enables out-of-order streaming of content. Rather than the traditional way of building the HTML you need on the server, or sending JSON down to a JavaScript framework, you can staple HTML onto the initial response and use the <template for=""> syntax to inject that content into the <?marker name=""> placeholder. A simple example of this would be: <!-- NOTE: FYI, throughout this post I'm using the closing `?>` syntax for `<?marker>` becuase the HTML highlighter likes that better. Either syntax works. --> <main id="main"> <?marker name="post-abc123" ?> </main> <!-- ...bunch of html goes here... --> <template for="post-abc123"> <div class="post"> <h2>Hello world</h2> <div>First post</div> </div> </template> The late-arriving template will auto-magically get slurped up into the <?marker> placeholder slot. Unlike the <slot> element though, once you…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.