s
March 1, 2024, 4:59 p.m. |

Simon Willison's Weblog simonwillison.net

Streaming HTML out of order without JavaScript


A really interesting new browser capability. If you serve the following HTML:


<template shadowrootmode="open">
<slot name="item-1">Loading...</slot>
</template>


Then later in the same page stream an element specifying that slot:


<span slot="item-1">Item number 1</span>


The previous slot will be replaced while the page continues to load.


I tried the demo in the most recent Chrome, Safari and Firefox (and Mobile Safari) and it worked in all of them.


The key feature is shadowrootmode=open, which …

browser browsers capability element html javascript loading page serve streaming template webcomponents will

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US