// 変更を監視するノードを選択 const targetNode = document.getElementById("some-id"); // (変更を監視する) オブザーバーのオプション const config = { attributes: true, childList: true, subtree: true }; // 変更が発見されたときに実行されるコールバック関数 const callback = function (mutationsList, observer) { // Use traditional 'for loops' for IE 11 for (const mutation of mutationsList) { if (mutation.type === "childList") { console.log("A child node has bee
![MutationObserver - Web API | MDN](https://cdn-ak-scissors.b.st-hatena.com/image/square/aa767575b4232d312d2c5de428f0bf0955805e26/height=288;version=1;width=512/https%3A%2F%2Fdeveloper.mozilla.org%2Fmdn-social-share.cd6c4a5a.png)