Use web storage to save DOM history.
Imagine that you want to undo the last three actions performed. You do not have to store it in memory, because you may lose page refresh information. And you really don't know if this action will be used to store in memory.
You can use web storage with data compression to store the smallest amount of data.
source share