Live data from Hacker News

Streaming HTML out of order without JavaScript

lamplightdev.com

1–10 of 104 posts

Re: Streaming HTML out of order without JavaScript

#4
At the core, this seems to be about shadowrootmode=open, a new html feature which already landed in Chromium and Safari:

    
      
        This is  and 
      
      sunny
      funny
    
renders as:

    This is funny and sunny
So it looks like HTML got a bit of a native template system now.

What I have been wanting for decades is a native template system in HTML which supports urls. Similar the the script tag, but which loads html:

    
    
    
I always wondered why this was never implemented. It seems such a basic functionality which would allow to comfortably build websites in a modular way without scripts or serverside processing.

Re: Streaming HTML out of order without JavaScript

#6
post #2

This looks very interesting, I was not aware that this was possible natively without JS. What's the browser support like?

Seems like browser support is pretty universal, even says so in the article

> All browsers support streaming HTML

And the caniuse is promising: https://caniuse.com/?search=slot

Re: Streaming HTML out of order without JavaScript

#7
post #4

At the core, this seems to be about shadowrootmode=open, a new html feature which already landed in Chromium and Safari: This is and sunny funny renders as: This is funny and sunny So it looks like HTML got a bit of a native template system now. What I have been wanting for decades is a native template system in HTML which supports urls. Similar the the script tag, but which loads html: I always wondered why this was…

It reminds me of FrontPage extensions, "good" times...

Re: Streaming HTML out of order without JavaScript

#8
post #4

At the core, this seems to be about shadowrootmode=open, a new html feature which already landed in Chromium and Safari: This is and sunny funny renders as: This is funny and sunny So it looks like HTML got a bit of a native template system now. What I have been wanting for decades is a native template system in HTML which supports urls. Similar the the script tag, but which loads html: I always wondered why this was…

While it needs a little JS to initialise, that’s easy enough to do with custom elements: https://github.com/gustafnk/h-include

Re: Streaming HTML out of order without JavaScript

#9
post #2

This looks very interesting, I was not aware that this was possible natively without JS. What's the browser support like?

Seems like browser support is pretty universal, even says so in the article > All browsers support streaming HTML And the caniuse is promising: https://caniuse.com/?search=slot

has been around for a while in Web Components; the relevant feature here is probably the (much newer) shadowrootmode attribute: https://caniuse.com/?search=shadowrootmode

But you can already do a lot with regular streaming and using CSS Grid, inline tags, etc to move stuff around the page.

Re: Streaming HTML out of order without JavaScript

#10
post #4

At the core, this seems to be about shadowrootmode=open, a new html feature which already landed in Chromium and Safari: This is and sunny funny renders as: This is funny and sunny So it looks like HTML got a bit of a native template system now. What I have been wanting for decades is a native template system in HTML which supports urls. Similar the the script tag, but which loads html: I always wondered why this was…

The last example reminds me of the once-proposed html imports feature. It was being pushed by Google back when Polymer was a thing and would've given us actual web components delivered as html documents with full support for html, css, and js just like we use normally. If I remember correctly there were a few issues with the approach that needed to be resolved and nobody stepped up to make it a reality. So instead we got the custom elements spec years later which only implemented a small percentage of what made html imports useful.
Post reply on HN