mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 12:59:05 +02:00
Release v5.2.0 (#36768)
* Bump version to 5.2.0 * Dist * Update masthead.html
This commit is contained in:
86
js/dist/tooltip.js
vendored
86
js/dist/tooltip.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap tooltip.js v5.2.0-beta1 (https://getbootstrap.com/)
|
||||
* Bootstrap tooltip.js v5.2.0 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.2.0-beta1): tooltip.js
|
||||
* Bootstrap (v5.2.0): tooltip.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -75,42 +75,42 @@
|
||||
LEFT: index.isRTL() ? 'right' : 'left'
|
||||
};
|
||||
const Default = {
|
||||
allowList: sanitizer.DefaultAllowlist,
|
||||
animation: true,
|
||||
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
|
||||
trigger: 'hover focus',
|
||||
title: '',
|
||||
delay: 0,
|
||||
html: false,
|
||||
selector: false,
|
||||
placement: 'top',
|
||||
offset: [0, 0],
|
||||
container: false,
|
||||
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
|
||||
boundary: 'clippingParents',
|
||||
container: false,
|
||||
customClass: '',
|
||||
delay: 0,
|
||||
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
|
||||
html: false,
|
||||
offset: [0, 0],
|
||||
placement: 'top',
|
||||
popperConfig: null,
|
||||
sanitize: true,
|
||||
sanitizeFn: null,
|
||||
allowList: sanitizer.DefaultAllowlist,
|
||||
popperConfig: null
|
||||
selector: false,
|
||||
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
|
||||
title: '',
|
||||
trigger: 'hover focus'
|
||||
};
|
||||
const DefaultType = {
|
||||
allowList: 'object',
|
||||
animation: 'boolean',
|
||||
template: 'string',
|
||||
title: '(string|element|function)',
|
||||
trigger: 'string',
|
||||
delay: '(number|object)',
|
||||
html: 'boolean',
|
||||
selector: '(string|boolean)',
|
||||
placement: '(string|function)',
|
||||
offset: '(array|string|function)',
|
||||
container: '(string|element|boolean)',
|
||||
fallbackPlacements: 'array',
|
||||
boundary: '(string|element)',
|
||||
container: '(string|element|boolean)',
|
||||
customClass: '(string|function)',
|
||||
delay: '(number|object)',
|
||||
fallbackPlacements: 'array',
|
||||
html: 'boolean',
|
||||
offset: '(array|string|function)',
|
||||
placement: '(string|function)',
|
||||
popperConfig: '(null|object|function)',
|
||||
sanitize: 'boolean',
|
||||
sanitizeFn: '(null|function)',
|
||||
allowList: 'object',
|
||||
popperConfig: '(null|object|function)'
|
||||
selector: '(string|boolean)',
|
||||
template: 'string',
|
||||
title: '(string|element|function)',
|
||||
trigger: 'string'
|
||||
};
|
||||
/**
|
||||
* Class definition
|
||||
@@ -129,7 +129,8 @@
|
||||
this._isHovered = false;
|
||||
this._activeTrigger = {};
|
||||
this._popper = null;
|
||||
this._templateFactory = null; // Protected
|
||||
this._templateFactory = null;
|
||||
this._newContent = null; // Protected
|
||||
|
||||
this.tip = null;
|
||||
|
||||
@@ -219,6 +220,12 @@
|
||||
|
||||
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||
return;
|
||||
} // todo v6 remove this OR make it optional
|
||||
|
||||
|
||||
if (this.tip) {
|
||||
this.tip.remove();
|
||||
this.tip = null;
|
||||
}
|
||||
|
||||
const tip = this._getTipElement();
|
||||
@@ -237,7 +244,7 @@
|
||||
if (this._popper) {
|
||||
this._popper.update();
|
||||
} else {
|
||||
this._createPopper(tip);
|
||||
this._popper = this._createPopper(tip);
|
||||
}
|
||||
|
||||
tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
|
||||
@@ -323,7 +330,7 @@
|
||||
|
||||
_getTipElement() {
|
||||
if (!this.tip) {
|
||||
this.tip = this._createTipElement(this._getContentForTemplate());
|
||||
this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
|
||||
}
|
||||
|
||||
return this.tip;
|
||||
@@ -351,19 +358,11 @@
|
||||
}
|
||||
|
||||
setContent(content) {
|
||||
let isShown = false;
|
||||
this._newContent = content;
|
||||
|
||||
if (this.tip) {
|
||||
isShown = this._isShown();
|
||||
this.tip.remove();
|
||||
this.tip = null;
|
||||
}
|
||||
if (this._isShown()) {
|
||||
this._disposePopper();
|
||||
|
||||
this._disposePopper();
|
||||
|
||||
this.tip = this._createTipElement(content);
|
||||
|
||||
if (isShown) {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
@@ -390,7 +389,7 @@
|
||||
}
|
||||
|
||||
_getTitle() {
|
||||
return this._config.title;
|
||||
return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
|
||||
} // Private
|
||||
|
||||
|
||||
@@ -409,7 +408,7 @@
|
||||
_createPopper(tip) {
|
||||
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
|
||||
const attachment = AttachmentMap[placement.toUpperCase()];
|
||||
this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
}
|
||||
|
||||
_getOffset() {
|
||||
@@ -522,7 +521,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||
if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
|
||||
this._element.setAttribute('aria-label', title);
|
||||
}
|
||||
|
||||
@@ -598,7 +597,6 @@
|
||||
}
|
||||
|
||||
config.originalTitle = this._element.getAttribute('title') || '';
|
||||
config.title = this._resolvePossibleFunction(config.title) || config.originalTitle;
|
||||
|
||||
if (typeof config.title === 'number') {
|
||||
config.title = config.title.toString();
|
||||
|
Reference in New Issue
Block a user