После удаления div id="test", ничего не происходит.В консоле никакой ошибки нет.
html -
<div id="test"></div>
JS -
document.addEventListener("DOMContentLoaded", function () {
const targetNode = document.getElementById('test');
const config = { attributes: true, childList: true, subtree: true, characterData: true };
const callback = function (mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
console.log("Deleted");
}
}
};
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);
})