const selectorClassNameDesktopGlobalHeaderItemsRight = `.target-class-name`;
const desktopGlobalHeaderItemsRightElm = document.querySelector(selectorClassNameDesktopGlobalHeaderItemsRight);
const desktopGlobalHeaderItemsRightElmObserver = new MutationObserver(desktopGlobalHeaderItemsRightElmObserverCallback);
desktopGlobalHeaderItemsRightElmObserver.observe(desktopGlobalHeaderItemsRightElm, desktopGlobalHeaderItemsRightElmObserverConfig);
有没有办法我可以知道MutationObsever
仍在跟踪DOM元素,在这种情况下为desktopGlobalHeaderItemsRightElm
。
我问是因为在被监视的DOM节点中进行了重新构造,甚至在检查后引用也相同,节点更改不再触发回调函数。