mirror of https://github.com/twbs/bootstrap.git
fix Tooltip component complete handlers [#37474]
* ensure `complete` handlers for `show` and `hide` check if the commponent was disposed * what can happen is the element can get removed from the DOM and the tooltip would get disposed * when the complete handler would run at a later point the component would be disposed and would throw various null related exceptions
This commit is contained in:
parent
523493d096
commit
666a3ae53d
|
@ -227,6 +227,11 @@ class Tooltip extends BaseComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
|
// component disposed
|
||||||
|
if (!this._element) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))
|
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))
|
||||||
|
|
||||||
if (this._isHovered === false) {
|
if (this._isHovered === false) {
|
||||||
|
@ -266,6 +271,11 @@ class Tooltip extends BaseComponent {
|
||||||
this._isHovered = null // it is a trick to support manual triggering
|
this._isHovered = null // it is a trick to support manual triggering
|
||||||
|
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
|
// component disposed
|
||||||
|
if (!this._element) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (this._isWithActiveTrigger()) {
|
if (this._isWithActiveTrigger()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue