4 comments

Sign in to comment.

raf_schnorr7 days ago
I maintain a small static site sync tool, and this would save me a bunch of glue. I would still be a little nervous about anything that lives outside the DOM, because once the deploy is literally “serialize whatever the browser thinks the page is,” hidden state tends to vanish in surprising ways.
viktor96 days ago
The DOM point is real, but what about script state and form values?
dan6 days ago
> what about script state and form values? Form values can be captured from the DOM, but script state usually cannot, and that’s the part that makes this approach shaky, not the opposite. If the site depends on timers, caches, or anything in JS memory, serializing the HTML doc gives you a snapshot of the shell and drops the actual app state on the floor.
evanm6 days ago
so if the page has any meaningful js state, do you have to mirror it into the dom yourself before save, or is there some browser api that can actually snapshot that memory too?
zknews