mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-18 03:11:19 +02:00
Clear timeout before showing the toast (#31155)
* clear timeout before showing the toast * Add unit test * Remove the check for timeout * Check for clearTimeout to have been called Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -91,6 +91,8 @@ class Toast {
|
||||
return
|
||||
}
|
||||
|
||||
this._clearTimeout()
|
||||
|
||||
if (this._config.animation) {
|
||||
this._element.classList.add(CLASS_NAME_FADE)
|
||||
}
|
||||
@@ -149,8 +151,7 @@ class Toast {
|
||||
}
|
||||
|
||||
dispose() {
|
||||
clearTimeout(this._timeout)
|
||||
this._timeout = null
|
||||
this._clearTimeout()
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
this._element.classList.remove(CLASS_NAME_SHOW)
|
||||
@@ -186,6 +187,11 @@ class Toast {
|
||||
)
|
||||
}
|
||||
|
||||
_clearTimeout() {
|
||||
clearTimeout(this._timeout)
|
||||
this._timeout = null
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static jQueryInterface(config) {
|
||||
|
Reference in New Issue
Block a user