From 57748f1e1c8eb2535ba6774e5081d8fb746266f0 Mon Sep 17 00:00:00 2001 From: Alaoui Karim Date: Wed, 30 Nov 2016 12:13:50 +0100 Subject: [PATCH] Fixing a error in dismiss function "el" may not be defined is the user dismissed the toast manually, so before removing it we must check its existence. Easy to reproduce : close the toast before it's automatically closed, you will see a js error. --- templates/notifications/toast/toast.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/notifications/toast/toast.js b/templates/notifications/toast/toast.js index f4718dc..29d493e 100644 --- a/templates/notifications/toast/toast.js +++ b/templates/notifications/toast/toast.js @@ -73,7 +73,9 @@ fabric.Toast = function (timer) { // remove the toast object from the body when the animation completes setTimeout(function () { var el = document.querySelector('#' + toast.id); - el.parentNode.removeChild(el); + if (el != null) { + el.parentNode.removeChild(el); + } }, 300); } } @@ -81,4 +83,4 @@ fabric.Toast = function (timer) { return { showToast: _showToast }; -}; \ No newline at end of file +};