Skip to content

Commit

Permalink
Remove the toast only, when the parent node was not removed before al…
Browse files Browse the repository at this point in the history
…ready which would lead to an exception. (#47)
  • Loading branch information
danielkaiser80 authored Mar 1, 2020
1 parent b093b16 commit 350b777
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/toastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@
// Removing the element from DOM after transition end
window.setTimeout(
function() {
// Remove the elemenf from the DOM
toastElement.parentNode.removeChild(toastElement);
// Remove the elemenf from the DOM, only when the parent node was not removed before.
if (toastElement.parentNode) {
toastElement.parentNode.removeChild(toastElement);
}

// Calling the callback function
this.options.callback.call(toastElement);
Expand Down

0 comments on commit 350b777

Please sign in to comment.