MCPcopy Create free account
hub / github.com/andreadev-it/stacking-contexts-inspector / startDOMObserver

Function startDOMObserver

src/scripts/content.js:253–269  ·  view source on GitHub ↗

* Start observing the changes in the DOM

()

Source from the content-addressed store, hash-verified

251 * Start observing the changes in the DOM
252 */
253function startDOMObserver() {
254
255 if (isObserverActive) {
256 console.warn("Tried starting the observer, but it was already running.");
257 return;
258 }
259
260 // Observer all the changes of the DOM elements position and attribute for the body tag and its children
261 const targetNode = document.body;
262 const config = { attributes: true, childList: true, subtree: true };
263
264 observer.observe(targetNode, config);
265 isObserverActive = true;
266
267 // Disconnect the observer when the user is leaving the page
268 window.addEventListener("beforeunload", disconnectObserver);
269}
270
271
272/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected