aboutsummaryrefslogtreecommitdiff
path: root/js/src/tooltip.js
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-04-11 02:27:18 +0300
committerMark Otto <[email protected]>2021-05-10 13:59:55 -0700
commit90b1a6907ed7bb3397fe6bd223f09eb12122d7a3 (patch)
treed666c155808a77ee51ab2296f549279b8f88873e /js/src/tooltip.js
parent9106d2a0eaa53a58d6cf6eef7250634329578843 (diff)
downloadbootstrap-90b1a6907ed7bb3397fe6bd223f09eb12122d7a3.tar.xz
bootstrap-90b1a6907ed7bb3397fe6bd223f09eb12122d7a3.zip
Merge js-components 'transitionend' listener callbacks into one method
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r--js/src/tooltip.js22
1 files changed, 4 insertions, 18 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 37ef8cb89..65eb7a11c 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -9,9 +9,7 @@ import * as Popper from '@popperjs/core'
import {
defineJQueryPlugin,
- emulateTransitionEnd,
findShadowRoot,
- getTransitionDurationFromElement,
getUID,
isElement,
isRTL,
@@ -315,13 +313,8 @@ class Tooltip extends BaseComponent {
}
}
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
- const transitionDuration = getTransitionDurationFromElement(this.tip)
- EventHandler.one(this.tip, 'transitionend', complete)
- emulateTransitionEnd(this.tip, transitionDuration)
- } else {
- complete()
- }
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE)
+ this._queueCallback(complete, this.tip, isAnimated)
}
hide() {
@@ -367,15 +360,8 @@ class Tooltip extends BaseComponent {
this._activeTrigger[TRIGGER_FOCUS] = false
this._activeTrigger[TRIGGER_HOVER] = false
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
- const transitionDuration = getTransitionDurationFromElement(tip)
-
- EventHandler.one(tip, 'transitionend', complete)
- emulateTransitionEnd(tip, transitionDuration)
- } else {
- complete()
- }
-
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE)
+ this._queueCallback(complete, this.tip, isAnimated)
this._hoverState = ''
}