Skip to content

Commit

Permalink
unload only if not mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeburns committed Mar 2, 2018
1 parent 829af66 commit e7c3305
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ if (window && window.MutationObserver) {
eachAttr(mutations[i], turnon, turnoff)
continue
}
eachMutation(mutations[i].removedNodes, turnoff)
eachMutation(mutations[i].removedNodes, function (index, el) {
if (!document.documentElement.contains(el)) turnoff(index, el)
})
eachMutation(mutations[i].addedNodes, turnon)
}
})
Expand Down

0 comments on commit e7c3305

Please sign in to comment.