I manipulated the DOM of web pages through some js libraries that changed the behavior of onMouseup onMousedown and onMousemove , among other things, which I cannot be sure of.
Using the DOM inspector, I saw that some of these changes are set as properties of the main document object.
So, what I'm trying to figure out is a way to save the initial state of the "document" object (or probably save the entire DOM?) When loading the page, so that I can restore it later.
My naive attempt:
var initial_state = document document = initial_state
Guess what? It didnβt work ... So ... what do I need to know and how can I do it right?
UPDATE : now I know that java is assigned by reference, not by value, so now I am experimenting with .extend (), but the main thing is, in any way, I can save the full state of the DOM at the initial stage (when the page is received), and then restore it a second time. In full state, I mean html, javascript state, properties and methods of the object, so when you restore it, the DOM will be exactly the same as the one you received for the first time.
I understand that this can be difficult and may require specific code of a specific code, directly proportional to the complexity of the state of the javascript code . But that would help, and I would be extremely grateful if I could see at least a sample code for the correct path in the simplest case (as in my example with an example example where you get some html and only some js that change values ββby default for onMousedown for the entire document).
source share