2 ms·
I'm not quite sure what you're doing, but I wonder if a new-ish browser api - Declarative Shadow DOM - could be useful here. It allows for sending a sort of htm
by nchmy 2y ago
I'm not quite sure what you're doing, but I wonder if a new-ish browser api - Declarative Shadow DOM - could be useful here. It allows for sending a sort of html shell to the browser that contains pre-defined placeholders, and then async sending the html fragments for those placeholders. No JS required.
It recently got support from all the major browsers.
- https://developer.chrome.com/docs/css-ui/declarative-shadow-dom https://developer.chrome.com/docs/css-ui/declarative-shadow-...
- https://lamplightdev.com/blog/2024/01/10/streaming-html-out-of-order-without-javascript/ https://lamplightdev.com/blog/2024/01/10/streaming-html-out-...
I'm also considering trying something similar to you, and thought that perhaps GoQuery (essentially jQuery written in much faster Golang) could be useful here. https://github.com/PuerkitoBio/goquery https://github.com/PuerkitoBio/goquery
If you need to do the scraping stuff, Colly could be used (which uses GoQuery under the hood). https://go-colly.org/ https://go-colly.org/
You could also create a sort of hypermedia "single page app" if you serve the shell once, and then use something like HTMX (or even jquery) to swap the body and other html fragments without a full page reload.