Commit 82b066f0 authored by Germán M. Bravo's avatar Germán M. Bravo
Browse files

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).
parent ee7498a6
Showing with 10 additions and 2 deletions
+10 -2
...@@ -56,7 +56,11 @@ ...@@ -56,7 +56,11 @@
this.transitioning = 1 this.transitioning = 1
var complete = function (e) { 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 this.$element
.removeClass('collapsing') .removeClass('collapsing')
.addClass('collapse in')[dimension]('auto') .addClass('collapse in')[dimension]('auto')
...@@ -92,7 +96,11 @@ ...@@ -92,7 +96,11 @@
this.transitioning = 1 this.transitioning = 1
var complete = function (e) { 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.transitioning = 0
this.$element this.$element
.trigger('hidden.bs.collapse') .trigger('hidden.bs.collapse')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment