diff options
| author | GeoSot <[email protected]> | 2021-11-26 02:15:24 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2021-12-01 18:00:36 +0200 |
| commit | 3baeb0a5c12eb1bcea9336c883e8788b9dad68f8 (patch) | |
| tree | d97dec3f10e4d270df6989b5daba58c39aa4f526 /js | |
| parent | 53c77c020368dbd570bd2d29ffc0c3660a0f6ab3 (diff) | |
| download | bootstrap-3baeb0a5c12eb1bcea9336c883e8788b9dad68f8.tar.xz bootstrap-3baeb0a5c12eb1bcea9336c883e8788b9dad68f8.zip | |
Tooltip: merge `isAnimated` checks
Diffstat (limited to 'js')
| -rw-r--r-- | js/src/tooltip.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js index b0963a002..a1e701981 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -271,8 +271,7 @@ class Tooltip extends BaseComponent { } } - const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE) - this._queueCallback(complete, this.tip, isAnimated) + this._queueCallback(complete, this.tip, this._isAnimated()) } hide() { @@ -315,8 +314,7 @@ class Tooltip extends BaseComponent { this._activeTrigger[TRIGGER_FOCUS] = false this._activeTrigger[TRIGGER_HOVER] = false - const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE) - this._queueCallback(complete, this.tip, isAnimated) + this._queueCallback(complete, this.tip, this._isAnimated()) this._hoverState = '' } @@ -355,7 +353,7 @@ class Tooltip extends BaseComponent { tip.setAttribute('id', tipId) - if (this._config.animation) { + if (this._isAnimated()) { tip.classList.add(CLASS_NAME_FADE) } @@ -409,6 +407,10 @@ class Tooltip extends BaseComponent { return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()) } + _isAnimated() { + return this._config.animation || (this.tip && this.tip.classList.contains(CLASS_NAME_FADE)) + } + _getOffset() { const { offset } = this._config |
