From: Germán M. Bravo Date: Sat, 12 Apr 2014 19:44:35 +0000 (-0500) Subject: Wait for the expected target during a collapse X-Git-Tag: v3.2.0~253^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82b066f0a91b6ff0fb5e49b43382dd44d0f35134;p=thirdparty%2Fbootstrap.git Wait for the expected target during a collapse Actually wait for the collapsed item to complete. If complete is called with other target, instead of simply returning and do nothing, wait again until the proper target triggers the event (otherwise this leaves collapse in a broken state). --- diff --git a/js/collapse.js b/js/collapse.js index 6f2205b6ff..42563c08e7 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -56,7 +56,11 @@ this.transitioning = 1 var complete = function (e) { - if (e && e.target != this.$element[0]) return + if (e && e.target != this.$element[0]) { + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + return + } this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('auto') @@ -92,7 +96,11 @@ this.transitioning = 1 var complete = function (e) { - if (e && e.target != this.$element[0]) return + if (e && e.target != this.$element[0]) { + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + return + } this.transitioning = 0 this.$element .trigger('hidden.bs.collapse')