diff options
| author | Patrick H. Lauke <[email protected]> | 2021-05-04 12:46:06 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-04 12:46:06 +0100 |
| commit | 8865a8ab1c7157ab81bf49afa62b75f36daee46d (patch) | |
| tree | 97ef78f2ea8e07aab50014176d061fe3c1d49134 /js/src/toast.js | |
| parent | 018ee6a3b50b958ddb49657086cd9168abf5a485 (diff) | |
| parent | 7ea6578773cb1b7f5cfb8fb41321b3fa10349daf (diff) | |
| download | bootstrap-jo-docs-thanks-page.tar.xz bootstrap-jo-docs-thanks-page.zip | |
Merge branch 'main' into jo-docs-thanks-pagejo-docs-thanks-page
Diffstat (limited to 'js/src/toast.js')
| -rw-r--r-- | js/src/toast.js | 28 |
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 |
