Is it possible to determine if the DOM has been changed and which part?

Are there any practical ways to determine which part of the DOM has been changed if you know that it will be changed?

I am writing a plugin that will work along with javascript that I did not write. the event will be triggered before the DOM changes, and after the change, one event will occur. My task is to decide what has changed. is this possible, and if so, what is the least terrible way to do this?

+7
javascript jquery dom events
source share
5 answers

This is not possible in any practical manner.

0
source share

Depending on the required browser support, you can use DOM mutation events .

+6
source share

Perhaps if you know which aspect of the DOM elements should be changed, you need to store the value of this attribute in the .data () node for each page load element, and then compare after the script is executed.

+1
source share

You can also hash the page text (for example, the full source string) and compare it (when changing) with the current hash.

0
source share

With jquery you can call: an animated filter to search for animated elements, I don’t know if you will have so many delays between these events, but if the main trigger of the initial conversion only starts when the transformation is triggered, you can try to catch: the animated element and capture the initial state before the animation ends, and then complete the capture state and compare, its the only hint I don’t have any demonstration or way to reproduce your working environment, but I hope this guide may give you an idea.

0
source share

All Articles