aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src/tooltip.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
committerMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
commit108a3efe0b6d37a7ed394a84c69b924ca727f17a (patch)
treeed9904767622d769fcee883d407310087ed7d57a /vendor/twbs/bootstrap/js/src/tooltip.js
parentccd826f63a7a4c7e442fab8a70d9c4c84808b417 (diff)
downloadvolse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.gz
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.bz2
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.zip
update composer libs
Diffstat (limited to 'vendor/twbs/bootstrap/js/src/tooltip.js')
-rw-r--r--vendor/twbs/bootstrap/js/src/tooltip.js62
1 files changed, 26 insertions, 36 deletions
diff --git a/vendor/twbs/bootstrap/js/src/tooltip.js b/vendor/twbs/bootstrap/js/src/tooltip.js
index 54ec0367e..e01f0a4ae 100644
--- a/vendor/twbs/bootstrap/js/src/tooltip.js
+++ b/vendor/twbs/bootstrap/js/src/tooltip.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): tooltip.js
+ * Bootstrap (v5.2.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -111,7 +111,7 @@ class Tooltip extends BaseComponent {
// Private
this._isEnabled = true
this._timeout = 0
- this._isHovered = false
+ this._isHovered = null
this._activeTrigger = {}
this._popper = null
this._templateFactory = null
@@ -121,6 +121,10 @@ class Tooltip extends BaseComponent {
this.tip = null
this._setListeners()
+
+ if (!this._config.selector) {
+ this._fixTitle()
+ }
}
// Getters
@@ -149,25 +153,12 @@ class Tooltip extends BaseComponent {
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()
return
@@ -185,6 +176,10 @@ class Tooltip extends BaseComponent {
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()
}
@@ -242,14 +237,13 @@ class Tooltip extends BaseComponent {
}
const complete = () => {
- const previousHoverState = this._isHovered
-
- this._isHovered = false
EventHandler.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())
@@ -279,7 +273,7 @@ class Tooltip extends BaseComponent {
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()) {
@@ -372,7 +366,7 @@ class Tooltip extends BaseComponent {
}
_getTitle() {
- return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle
+ return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')
}
// Private
@@ -466,7 +460,10 @@ class Tooltip extends BaseComponent {
for (const trigger of triggers) {
if (trigger === 'click') {
- EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => this.toggle(event))
+ EventHandler.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) :
@@ -497,20 +494,10 @@ class Tooltip extends BaseComponent {
}
EventHandler.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
@@ -520,6 +507,7 @@ class Tooltip extends BaseComponent {
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')
}
@@ -590,7 +578,6 @@ class Tooltip extends BaseComponent {
}
}
- config.originalTitle = this._element.getAttribute('title') || ''
if (typeof config.title === 'number') {
config.title = config.title.toString()
}
@@ -611,6 +598,9 @@ class Tooltip extends BaseComponent {
}
}
+ 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)`