Imagine there's a website with a specific HTML element. It seems that this element has the same class during the DOMContentLoaded
event as it does during the load
event. However, after the load
event, this class (and possibly the ID and other HTML attributes) are changed.
I'm interested in monitoring this element from the moment it's first added to the DOM, so that any changes to its HTML are automatically tracked.
Is there a way to observe a DOM mutation of an element using a CSS selector? If so, how can this be done?
I'm posing this question with the assumption that I've correctly grasped the concept of "observation" in JavaScript.