Skip to content

Commit

Permalink
FIX for oldestFirst
Browse files Browse the repository at this point in the history
the options oldesFirst was not correctly implemented
  • Loading branch information
BarryDam authored Jan 6, 2025
1 parent 99a1f11 commit db9cf62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/toastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit db9cf62

Please sign in to comment.