I have html page built by javascript at runtime. At some moment of time I want to create a backup of this page to be able to restore it later. The page is described by DOM, so it's logically to save the DOM itself. The problem is - it seems there are no legit ways to do so.
I only found XMLSerializer interface which can be used to serialize html only (so, that's not the right tool). But I need to save mutation observers and event listeners, such 'restored' page would behave as it's ancestor.
I also thought about recording to log file javascript operations over DOM. But the page that is building itself in runtime is huge and complicated, so such approach will cost a lot of time.
Any ideas?