By default, a method A() is executed, which will modify the order and style of the elements, and then need to restore these elements to their original state. Could you please tell me how to do this? The most important thing is that method A is executed by default. If you want to reset it after some operations, you can implement either jquery or native methods.
给我你的怀抱2017-05-24 11:39:03
I have found the simplest method myself, but thank you for your enthusiastic answers. Here I will briefly share my ideas: jquery or original are the same, just delete the style attribute of the element directly, because all JS style operations are based on style Attributes.
仅有的幸福2017-05-24 11:39:03
Before going through method a, store the value of a in localstorage. When it needs to be reset, just assign the value of a in the storage to the variable of a
PHPz2017-05-24 11:39:03
Now, the original data remains unchanged (if all you get at the front end is DOM, you can traverse it once and make a JSON data source) and make a temporary domain object for the middleware; HTML is presented through JS; JS modification only modifies the middleware. Just leave the original data unchanged; the so-called "reset" is actually re-initialization (if there are modifications, save the modifications and then initialize again);
This cannot be rolled back
|-------| |-------|
|Original data| ==> |-DOM modification|
|-------| | -------|
In this case, if you "reset", it actually just clears the DOM and remaps it from the original data;
|-------| |-------| |----- --|
|Original data| ==> |Object in domain| ==> |-DOM mapping|
|-------| |-------| |----- --|