mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-23 00:39:54 +00:00
Fix tooltip data-bs-original-title
issue (#34842)
This commit is contained in:
parent
ef21000cbe
commit
51afe026ca
@ -211,10 +211,7 @@ class Tooltip extends BaseComponent {
|
|||||||
this.tip.remove()
|
this.tip.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._popper) {
|
this._disposePopper()
|
||||||
this._popper.destroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
super.dispose()
|
super.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +234,14 @@ class Tooltip extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
|
||||||
|
// This will be removed later in favor of a `setContent` method
|
||||||
|
if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
|
||||||
|
this._disposePopper()
|
||||||
|
this.tip.remove()
|
||||||
|
this.tip = null
|
||||||
|
}
|
||||||
|
|
||||||
const tip = this.getTipElement()
|
const tip = this.getTipElement()
|
||||||
const tipId = getUID(this.constructor.NAME)
|
const tipId = getUID(this.constructor.NAME)
|
||||||
|
|
||||||
@ -319,10 +324,7 @@ class Tooltip extends BaseComponent {
|
|||||||
this._element.removeAttribute('aria-describedby')
|
this._element.removeAttribute('aria-describedby')
|
||||||
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
|
||||||
|
|
||||||
if (this._popper) {
|
this._disposePopper()
|
||||||
this._popper.destroy()
|
|
||||||
this._popper = null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)
|
||||||
@ -725,6 +727,13 @@ class Tooltip extends BaseComponent {
|
|||||||
this._addAttachmentClass(this._getAttachment(state.placement))
|
this._addAttachmentClass(this._getAttachment(state.placement))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_disposePopper() {
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy()
|
||||||
|
this._popper = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
static jQueryInterface(config) {
|
static jQueryInterface(config) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user