aboutsummaryrefslogtreecommitdiff
path: root/js/src/toast.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/toast.js')
-rw-r--r--js/src/toast.js28
1 files changed, 6 insertions, 22 deletions
diff --git a/js/src/toast.js b/js/src/toast.js
index 30df4606a..5d762b29d 100644
--- a/js/src/toast.js
+++ b/js/src/toast.js
@@ -1,14 +1,12 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): toast.js
+ * Bootstrap (v5.0.0-beta3): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
- getjQuery,
- onDOMContentLoaded,
- TRANSITION_END,
+ defineJQueryPlugin,
emulateTransitionEnd,
getTransitionDurationFromElement,
reflow,
@@ -117,7 +115,7 @@ class Toast extends BaseComponent {
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element)
- EventHandler.one(this._element, TRANSITION_END, complete)
+ EventHandler.one(this._element, 'transitionend', complete)
emulateTransitionEnd(this._element, transitionDuration)
} else {
complete()
@@ -144,7 +142,7 @@ class Toast extends BaseComponent {
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element)
- EventHandler.one(this._element, TRANSITION_END, complete)
+ EventHandler.one(this._element, 'transitionend', complete)
emulateTransitionEnd(this._element, transitionDuration)
} else {
complete()
@@ -158,8 +156,6 @@ class Toast extends BaseComponent {
this._element.classList.remove(CLASS_NAME_SHOW)
}
- EventHandler.off(this._element, EVENT_CLICK_DISMISS)
-
super.dispose()
this._config = null
}
@@ -191,7 +187,7 @@ class Toast extends BaseComponent {
static jQueryInterface(config) {
return this.each(function () {
- let data = Data.getData(this, DATA_KEY)
+ let data = Data.get(this, DATA_KEY)
const _config = typeof config === 'object' && config
if (!data) {
@@ -216,18 +212,6 @@ class Toast extends BaseComponent {
* add .Toast to jQuery only if jQuery is present
*/
-onDOMContentLoaded(() => {
- const $ = getjQuery()
- /* istanbul ignore if */
- if ($) {
- const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Toast.jQueryInterface
- $.fn[NAME].Constructor = Toast
- $.fn[NAME].noConflict = () => {
- $.fn[NAME] = JQUERY_NO_CONFLICT
- return Toast.jQueryInterface
- }
- }
-})
+defineJQueryPlugin(NAME, Toast)
export default Toast