aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Fenkart <[email protected]>2014-09-13 03:11:03 +0200
committerHeinrich Fenkart <[email protected]>2014-09-13 03:11:03 +0200
commita3a04bfe53827c88f70f4162e33535f6ed56d287 (patch)
treef80e831203fcf1ca2ee9dd159b69de616697f00a
parent0fe48a78c105410ec5abac88418f3395b245e33c (diff)
parent76762169c359b381f70fa518daef09e76b0aefe3 (diff)
downloadbootstrap-a3a04bfe53827c88f70f4162e33535f6ed56d287.tar.xz
bootstrap-a3a04bfe53827c88f70f4162e33535f6ed56d287.zip
Merge pull request #14571 from twbs/properly-hide-tooltip-on-destroy
Properly fire hidden event when tooltip is destroyed
-rw-r--r--js/tooltip.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/tooltip.js b/js/tooltip.js
index 5192d38fc..1e10af27f 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -281,7 +281,7 @@
$tip.removeClass('fade in top bottom left right')
}
- Tooltip.prototype.hide = function () {
+ Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
@@ -291,6 +291,7 @@
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
+ callback && callback()
}
this.$element.trigger(e)
@@ -438,8 +439,11 @@
}
Tooltip.prototype.destroy = function () {
+ var that = this
clearTimeout(this.timeout)
- this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
+ this.hide(function () {
+ that.$element.off('.' + that.type).removeData('bs.' + that.type)
+ })
}