From 12868933b9141ff9c63277efe36665cc7a8815df Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 24 Dec 2011 23:06:16 -0800 Subject: [PATCH] clean up dead elements in firefox (which is droping transitionEnd events :( --- js/bootstrap-twipsy.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index 2651e38226..a176f09088 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -164,13 +164,20 @@ $tip.removeClass('in') - function removeElement () { - $tip.remove() + function removeWithAnimation() { + var timeout = setTimeout(function () { + $tip.off($.support.transition.end).remove() + }, 500) + + $tip.one($.support.transition.end, function () { + clearTimeout(timeout) + $tip.remove() + }) } $.support.transition && this.$tip.hasClass('fade') ? - $tip.on($.support.transition.end, removeElement) : - removeElement() + removeWithAnimation() : + $tip.remove() } , fixTitle: function () {