diff --git a/js/alert.js b/js/alert.js index f7fc6fb8e29f..609127a2c775 100644 --- a/js/alert.js +++ b/js/alert.js @@ -54,7 +54,7 @@ $.support.transition && $parent.hasClass('fade') ? $parent - .one($.support.transition.end, removeElement) + .one('bsTransitionEnd', removeElement) .emulateTransitionEnd(150) : removeElement() } diff --git a/js/carousel.js b/js/carousel.js index af51cf50d541..dcaccf8d7fa5 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -132,7 +132,7 @@ $active.addClass(direction) $next.addClass(direction) $active - .one($.support.transition.end, function () { + .one('bsTransitionEnd', function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false diff --git a/js/collapse.js b/js/collapse.js index d5d74d07b980..add4aea9214e 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -61,18 +61,12 @@ this.transitioning = 1 - var complete = function (e) { - if (e && e.target != this.$element[0]) { - this.$element - .one($.support.transition.end, $.proxy(complete, this)) - return - } + var complete = function () { this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('') this.transitioning = 0 this.$element - .off($.support.transition.end + '.bs.collapse') .trigger('shown.bs.collapse') } @@ -81,7 +75,7 @@ var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element - .on($.support.transition.end + '.bs.collapse', $.proxy(complete, this)) + .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) } @@ -103,12 +97,7 @@ this.transitioning = 1 - var complete = function (e) { - if (e && e.target != this.$element[0]) { - this.$element - .one($.support.transition.end, $.proxy(complete, this)) - return - } + var complete = function () { this.transitioning = 0 this.$element .trigger('hidden.bs.collapse') @@ -120,7 +109,7 @@ this.$element [dimension](0) - .one($.support.transition.end, $.proxy(complete, this)) + .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(350) } diff --git a/js/modal.js b/js/modal.js index 2c363ec331ed..6b9b63f54602 100644 --- a/js/modal.js +++ b/js/modal.js @@ -89,7 +89,7 @@ transition ? that.$element.find('.modal-dialog') // wait for modal to slide in - .one($.support.transition.end, function () { + .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(300) : @@ -122,7 +122,7 @@ $.support.transition && this.$element.hasClass('fade') ? this.$element - .one($.support.transition.end, $.proxy(this.hideModal, this)) + .one('bsTransitionEnd', $.proxy(this.hideModal, this)) .emulateTransitionEnd(300) : this.hideModal() } @@ -185,7 +185,7 @@ doAnimate ? this.$backdrop - .one($.support.transition.end, callback) + .one('bsTransitionEnd', callback) .emulateTransitionEnd(150) : callback() @@ -198,7 +198,7 @@ } $.support.transition && this.$element.hasClass('fade') ? this.$backdrop - .one($.support.transition.end, callbackRemove) + .one('bsTransitionEnd', callbackRemove) .emulateTransitionEnd(150) : callbackRemove() diff --git a/js/tab.js b/js/tab.js index 57ae6bc9f230..3eec7c2df80e 100644 --- a/js/tab.js +++ b/js/tab.js @@ -85,7 +85,7 @@ transition ? $active - .one($.support.transition.end, next) + .one('bsTransitionEnd', next) .emulateTransitionEnd(150) : next() diff --git a/js/tooltip.js b/js/tooltip.js index 692651457f9a..b04dccd9198a 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -210,7 +210,7 @@ $.support.transition && this.$tip.hasClass('fade') ? $tip - .one($.support.transition.end, complete) + .one('bsTransitionEnd', complete) .emulateTransitionEnd(150) : complete() } @@ -298,7 +298,7 @@ $.support.transition && this.$tip.hasClass('fade') ? $tip - .one($.support.transition.end, complete) + .one('bsTransitionEnd', complete) .emulateTransitionEnd(150) : complete() diff --git a/js/transition.js b/js/transition.js index 8fcf8ff4bd28..efc66bae992d 100644 --- a/js/transition.js +++ b/js/transition.js @@ -40,7 +40,7 @@ $.fn.emulateTransitionEnd = function (duration) { var called = false var $el = this - $(this).one($.support.transition.end, function () { called = true }) + $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this @@ -48,6 +48,16 @@ $(function () { $.support.transition = transitionEnd() + + if (!$.support.transition) return + + $.event.special.bsTransitionEnd = { + bindType: $.support.transition.end, + delegateType: $.support.transition.end, + handle: function (e) { + if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) + } + } }) });