From: Jacob Thornton Date: Sun, 25 Dec 2011 07:06:16 +0000 (-0800) Subject: clean up dead elements in firefox (which is droping transitionEnd events :( X-Git-Tag: v2.0.0~6^2~387^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12868933b9141ff9c63277efe36665cc7a8815df;p=thirdparty%2Fbootstrap.git clean up dead elements in firefox (which is droping transitionEnd events :( --- 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 () {