mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +02:00
Refactor util plugin and some tests
This commit is contained in:
@@ -127,7 +127,7 @@ class Tooltip {
|
||||
* Popper - https://popper.js.org
|
||||
*/
|
||||
if (typeof Popper === 'undefined') {
|
||||
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)')
|
||||
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)')
|
||||
}
|
||||
|
||||
// private
|
||||
@@ -201,7 +201,7 @@ class Tooltip {
|
||||
|
||||
if (!context) {
|
||||
context = new this.constructor(
|
||||
event.currentTarget,
|
||||
event.delegateTarget,
|
||||
this._getDelegateConfig()
|
||||
)
|
||||
Data.setData(event.delegateTarget, dataKey, context)
|
||||
@@ -344,7 +344,6 @@ class Tooltip {
|
||||
|
||||
if (this.tip.classList.contains(ClassName.FADE)) {
|
||||
const transitionDuration = Util.getTransitionDurationFromElement(this.tip)
|
||||
|
||||
EventHandler.one(this.tip, Util.TRANSITION_END, complete)
|
||||
Util.emulateTransitionEnd(this.tip, transitionDuration)
|
||||
} else {
|
||||
@@ -383,7 +382,7 @@ class Tooltip {
|
||||
// empty mouseover listeners we added for iOS support
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
Util.makeArray(document.body.children)
|
||||
.forEach((element) => EventHandler.off(element, 'mouseover', Util.noop()))
|
||||
.forEach((element) => EventHandler.off(element, 'mouseover', Util.noop))
|
||||
}
|
||||
|
||||
this._activeTrigger[Trigger.CLICK] = false
|
||||
@@ -392,7 +391,6 @@ class Tooltip {
|
||||
|
||||
if (this.tip.classList.contains(ClassName.FADE)) {
|
||||
const transitionDuration = Util.getTransitionDurationFromElement(tip)
|
||||
|
||||
EventHandler.one(tip, Util.TRANSITION_END, complete)
|
||||
Util.emulateTransitionEnd(tip, transitionDuration)
|
||||
} else {
|
||||
@@ -754,11 +752,9 @@ class Tooltip {
|
||||
_fixTransition() {
|
||||
const tip = this.getTipElement()
|
||||
const initConfigAnimation = this.config.animation
|
||||
|
||||
if (tip.getAttribute('x-placement') !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
tip.classList.remove(ClassName.FADE)
|
||||
this.config.animation = false
|
||||
this.hide()
|
||||
|
Reference in New Issue
Block a user