aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/tooltip.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/tooltip.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/tooltip.js68
1 files changed, 31 insertions, 37 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/tooltip.js b/vendor/twbs/bootstrap/js/dist/tooltip.js
index 56744f188..cc46139e4 100644
--- a/vendor/twbs/bootstrap/js/dist/tooltip.js
+++ b/vendor/twbs/bootstrap/js/dist/tooltip.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap tooltip.js v5.2.0 (https://getbootstrap.com/)
+ * Bootstrap tooltip.js v5.2.2 (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): tooltip.js
+ * Bootstrap (v5.2.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -126,7 +126,7 @@
this._isEnabled = true;
this._timeout = 0;
- this._isHovered = false;
+ this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
this._templateFactory = null;
@@ -135,6 +135,10 @@
this.tip = null;
this._setListeners();
+
+ if (!this._config.selector) {
+ this._fixTitle();
+ }
} // Getters
@@ -163,24 +167,12 @@
this._isEnabled = !this._isEnabled;
}
- toggle(event) {
+ toggle() {
if (!this._isEnabled) {
return;
}
- if (event) {
- const context = this._initializeOnDelegatedTarget(event);
-
- context._activeTrigger.click = !context._activeTrigger.click;
-
- if (context._isWithActiveTrigger()) {
- context._enter();
- } else {
- context._leave();
- }
-
- return;
- }
+ this._activeTrigger.click = !this._activeTrigger.click;
if (this._isShown()) {
this._leave();
@@ -199,6 +191,10 @@
this.tip.remove();
}
+ if (this._element.getAttribute('data-bs-original-title')) {
+ this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
+ }
+
this._disposePopper();
super.dispose();
@@ -259,13 +255,13 @@
}
const complete = () => {
- const previousHoverState = this._isHovered;
- this._isHovered = false;
EventHandler__default.default.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
- if (previousHoverState) {
+ if (this._isHovered === false) {
this._leave();
}
+
+ this._isHovered = false;
};
this._queueCallback(complete, this.tip, this._isAnimated());
@@ -296,7 +292,7 @@
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
- this._isHovered = false;
+ this._isHovered = null; // it is a trick to support manual triggering
const complete = () => {
if (this._isWithActiveTrigger()) {
@@ -389,7 +385,7 @@
}
_getTitle() {
- return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
+ return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
} // Private
@@ -475,7 +471,11 @@
for (const trigger of triggers) {
if (trigger === 'click') {
- EventHandler__default.default.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => this.toggle(event));
+ EventHandler__default.default.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
+ const context = this._initializeOnDelegatedTarget(event);
+
+ context.toggle();
+ });
} else if (trigger !== TRIGGER_MANUAL) {
const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN);
const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT);
@@ -503,19 +503,10 @@
};
EventHandler__default.default.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
-
- if (this._config.selector) {
- this._config = { ...this._config,
- trigger: 'manual',
- selector: ''
- };
- } else {
- this._fixTitle();
- }
}
_fixTitle() {
- const title = this._config.originalTitle;
+ const title = this._element.getAttribute('title');
if (!title) {
return;
@@ -525,6 +516,9 @@
this._element.setAttribute('aria-label', title);
}
+ this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
+
+
this._element.removeAttribute('title');
}
@@ -596,8 +590,6 @@
};
}
- config.originalTitle = this._element.getAttribute('title') || '';
-
if (typeof config.title === 'number') {
config.title = config.title.toString();
}
@@ -616,11 +608,13 @@
if (this.constructor.Default[key] !== this._config[key]) {
config[key] = this._config[key];
}
- } // In the future can be replaced with:
+ }
+
+ config.selector = false;
+ config.trigger = 'manual'; // In the future can be replaced with:
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
// `Object.fromEntries(keysWithDifferentValues)`
-
return config;
}