Permalink
Browse files

fix(observedom): Callback not being called for changes other than nod…

…e inert/remove

Allow callback to be called based on passed options.

Previously it was only being called if nodes were added or inserted, regardless of which options were passed (i.e. attribute changes, childList, textnode changes, etc.)

This fix remove this restriction.
  • Loading branch information...
tmorehouse committed Sep 11, 2017
1 parent 5790b39 commit 92ef7eb997763bcf5643e70fb75bf293a6e9f365
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/utils/observe-dom.js
@@ -14,9 +14,7 @@ export default function observeDOM(el, callback, opts) {
if (MutationObserver) {
// Define a new observer
const obs = new MutationObserver(mutations => {
if (mutations[0].addedNodes.length > 0 || mutations[0].removedNodes.length > 0) {
callback();
}
callback();
});

// Have the observer observe foo for changes in children

0 comments on commit 92ef7eb

Please sign in to comment.