From db9cf620f3cf95e4cfc8f439b261988d722c3c16 Mon Sep 17 00:00:00 2001 From: Barry Dam Date: Mon, 6 Jan 2025 16:01:19 +0100 Subject: [PATCH] FIX for oldestFirst the options oldesFirst was not correctly implemented --- src/toastify.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/toastify.js b/src/toastify.js index 5d9659c..a9ed63e 100644 --- a/src/toastify.js +++ b/src/toastify.js @@ -86,6 +86,7 @@ this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup; this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive; this.options.style = options.style || Toastify.defaults.style; + this.options.oldestFirst = options.oldestFirst !== undefined ? options.oldestFirst : Toastify.defaults.oldestFirst; if(options.backgroundColor) { this.options.style.background = options.backgroundColor; } @@ -285,7 +286,7 @@ } // Adding the DOM element - var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild; + var elementToInsert = Toastify.options.oldestFirst ? rootElement.firstChild : rootElement.lastChild; rootElement.insertBefore(this.toastElement, elementToInsert); // Repositioning the toasts in case multiple toasts are present