Skip to content

Commit

Permalink
Clear tooltip's $element to prevent leaking memory. Fixes twbs#17973
Browse files Browse the repository at this point in the history
Closes twbs#19659
  • Loading branch information
gregsheremeta authored and chiragatlas committed Apr 8, 2019
1 parent cf1fb8f commit 3388628
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/tooltip.js
Expand Up @@ -317,9 +317,11 @@

function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
}
callback && callback()
}

Expand Down Expand Up @@ -478,6 +480,7 @@
that.$tip = null
that.$arrow = null
that.$viewport = null
that.$element = null
})
}

Expand Down

0 comments on commit 3388628

Please sign in to comment.