MutationObserver는 DOM요소노드를 관찰하고 변경사항을 감지하여 콜백을 호출하는 객체다.
let observer = new MutationObserver(callback);
observer.observe(node, config);
config객체
childList – changes in the direct children of node,
subtree – in all descendants of node,
attributes – attributes of node,
attributeFilter – an array of attribute names, to observe only selected ones.
characterData – whether to observe node.data (text content),
attributeOldValue - true인 경우 속성의 이전 값과 새 값을 콜백에 전달하고(아래 참조), 그렇지 않으면 새 값만 전달(속성 옵션 필요).
characterDataOldValue - true인 경우 node.data의 이전 값과 새 값을 콜백에 전달하고(아래 참조), 그렇지 않으면 새 값만 전달(characterData 옵션 필요).