Skip to content

Commit

Permalink
fix(observedom): Callback not being called for changes other than nod…
Browse files Browse the repository at this point in the history
…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 92ef7eb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/utils/observe-dom.js
Expand Up @@ -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
Expand Down

0 comments on commit 92ef7eb

Please sign in to comment.