mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-24 14:13:06 +02:00
toast should allow prevent default for hide and show events
This commit is contained in:
@@ -90,7 +90,11 @@ class Toast {
|
||||
// Public
|
||||
|
||||
show() {
|
||||
EventHandler.trigger(this._element, Event.SHOW)
|
||||
const showEvent = EventHandler.trigger(this._element, Event.SHOW)
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this._config.animation) {
|
||||
this._element.classList.add(ClassName.FADE)
|
||||
@@ -126,7 +130,11 @@ class Toast {
|
||||
return
|
||||
}
|
||||
|
||||
EventHandler.trigger(this._element, Event.HIDE)
|
||||
const hideEvent = EventHandler.trigger(this._element, Event.HIDE)
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
return
|
||||
}
|
||||
|
||||
const complete = () => {
|
||||
this._element.classList.add(ClassName.HIDE)
|
||||
|
Reference in New Issue
Block a user