mod/bootstrap/vendor/bootstrap/js/src/tooltip.js in card-1.94.1 vs mod/bootstrap/vendor/bootstrap/js/src/tooltip.js in card-1.95.0
- old
+ new
@@ -2,11 +2,11 @@
import Popper from 'popper.js'
import Util from './util'
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.0.0): tooltip.js
+ * Bootstrap (v4.1.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const Tooltip = (($) => {
@@ -14,17 +14,16 @@
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
- const NAME = 'tooltip'
- const VERSION = '4.0.0'
- const DATA_KEY = 'bs.tooltip'
- const EVENT_KEY = `.${DATA_KEY}`
- const JQUERY_NO_CONFLICT = $.fn[NAME]
- const TRANSITION_DURATION = 150
- const CLASS_PREFIX = 'bs-tooltip'
+ const NAME = 'tooltip'
+ const VERSION = '4.1.1'
+ const DATA_KEY = 'bs.tooltip'
+ const EVENT_KEY = `.${DATA_KEY}`
+ const JQUERY_NO_CONFLICT = $.fn[NAME]
+ const CLASS_PREFIX = 'bs-tooltip'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DefaultType = {
animation : 'boolean',
template : 'string',
@@ -315,11 +314,11 @@
// If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement) {
- $('body').children().on('mouseover', null, $.noop)
+ $(document.body).children().on('mouseover', null, $.noop)
}
const complete = () => {
if (this.config.animation) {
this._fixTransition()
@@ -332,14 +331,16 @@
if (prevHoverState === HoverState.OUT) {
this._leave(null, this)
}
}
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
+ if ($(this.tip).hasClass(ClassName.FADE)) {
+ const transitionDuration = Util.getTransitionDurationFromElement(this.tip)
+
$(this.tip)
.one(Util.TRANSITION_END, complete)
- .emulateTransitionEnd(Tooltip._TRANSITION_DURATION)
+ .emulateTransitionEnd(transitionDuration)
} else {
complete()
}
}
}
@@ -373,22 +374,23 @@
$(tip).removeClass(ClassName.SHOW)
// If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
- $('body').children().off('mouseover', null, $.noop)
+ $(document.body).children().off('mouseover', null, $.noop)
}
this._activeTrigger[Trigger.CLICK] = false
this._activeTrigger[Trigger.FOCUS] = false
this._activeTrigger[Trigger.HOVER] = false
- if (Util.supportsTransitionEnd() &&
- $(this.tip).hasClass(ClassName.FADE)) {
+ if ($(this.tip).hasClass(ClassName.FADE)) {
+ const transitionDuration = Util.getTransitionDurationFromElement(tip)
+
$(tip)
.one(Util.TRANSITION_END, complete)
- .emulateTransitionEnd(TRANSITION_DURATION)
+ .emulateTransitionEnd(transitionDuration)
} else {
complete()
}
this._hoverState = ''
@@ -607,10 +609,10 @@
_getConfig(config) {
config = {
...this.constructor.Default,
...$(this.element).data(),
- ...config
+ ...typeof config === 'object' && config ? config : {}
}
if (typeof config.delay === 'number') {
config.delay = {
show: config.delay,