From 82b066f0a91b6ff0fb5e49b43382dd44d0f35134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20M=2E=20Bravo?= Date: Sat, 12 Apr 2014 14:44:35 -0500 Subject: [PATCH] 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). --- js/collapse.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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')