aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-07-22 18:13:13 +0300
committerGitHub <[email protected]>2021-07-22 18:13:13 +0300
commit41292a52570610dc312a775ae0491dc46f93a4fe (patch)
treece8185d87fd969dac7d7cf39b1f03c43452c5e4e /js/src
parente85a6ed77c92ee43cf23b5c6ce479dbd0100be66 (diff)
downloadbootstrap-41292a52570610dc312a775ae0491dc46f93a4fe.tar.xz
bootstrap-41292a52570610dc312a775ae0491dc46f93a4fe.zip
Toasts: Change showing timings and classes to keep toast `display:none` by default (#33610)
Diffstat (limited to 'js/src')
-rw-r--r--js/src/toast.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/js/src/toast.js b/js/src/toast.js
index b6c9bdd79..9b3c0f7c8 100644
--- a/js/src/toast.js
+++ b/js/src/toast.js
@@ -35,7 +35,7 @@ const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const CLASS_NAME_FADE = 'fade'
-const CLASS_NAME_HIDE = 'hide'
+const CLASS_NAME_HIDE = 'hide' // @deprecated - kept here only for backwards compatibility
const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_SHOWING = 'showing'
@@ -101,15 +101,14 @@ class Toast extends BaseComponent {
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING)
- this._element.classList.add(CLASS_NAME_SHOW)
-
EventHandler.trigger(this._element, EVENT_SHOWN)
this._maybeScheduleHide()
}
- this._element.classList.remove(CLASS_NAME_HIDE)
+ this._element.classList.remove(CLASS_NAME_HIDE) // @deprecated
reflow(this._element)
+ this._element.classList.add(CLASS_NAME_SHOW)
this._element.classList.add(CLASS_NAME_SHOWING)
this._queueCallback(complete, this._element, this._config.animation)
@@ -127,11 +126,13 @@ class Toast extends BaseComponent {
}
const complete = () => {
- this._element.classList.add(CLASS_NAME_HIDE)
+ this._element.classList.add(CLASS_NAME_HIDE) // @deprecated
+ this._element.classList.remove(CLASS_NAME_SHOWING)
+ this._element.classList.remove(CLASS_NAME_SHOW)
EventHandler.trigger(this._element, EVENT_HIDDEN)
}
- this._element.classList.remove(CLASS_NAME_SHOW)
+ this._element.classList.add(CLASS_NAME_SHOWING)
this._queueCallback(complete, this._element, this._config.animation)
}