]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Wait for the expected target during a collapse 13330/head
authorGermán M. Bravo <german.mb@gmail.com>
Sat, 12 Apr 2014 19:44:35 +0000 (14:44 -0500)
committerGermán M. Bravo <german.mb@gmail.com>
Sat, 12 Apr 2014 19:44:35 +0000 (14:44 -0500)
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

index 6f2205b6ff53352f6c2f2baa439ad80f1c38aecc..42563c08e73f06f1e671d22468a823d5e5fb82bf 100644 (file)
     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')
     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')