vendor/assets/javascripts/bootstrap/modal.js in css-bootstrap-rails-0.0.5 vs vendor/assets/javascripts/bootstrap/modal.js in css-bootstrap-rails-0.0.6
- old
+ new
@@ -1,7 +1,7 @@
/* =========================================================
- * bootstrap-modal.js v1.3.0
+ * bootstrap-modal.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#modal
* =========================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,10 +18,12 @@
* ========================================================= */
!function( $ ){
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
var transitionEnd
@@ -85,12 +87,11 @@
if (transition) {
that.$element[0].offsetWidth // force reflow
}
- that.$element
- .addClass('in')
+ that.$element.addClass('in')
transition ?
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
@@ -113,31 +114,45 @@
this.$element
.trigger('hide')
.removeClass('in')
- function removeElement () {
- that.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(that)
- }
-
$.support.transition && this.$element.hasClass('fade') ?
- this.$element.one(transitionEnd, removeElement) :
- removeElement()
+ hideWithTransition.call(this) :
+ hideModal.call(this)
return this
}
}
/* MODAL PRIVATE METHODS
* ===================== */
+ function hideWithTransition() {
+ // firefox drops transitionEnd events :{o
+ var that = this
+ , timeout = setTimeout(function () {
+ that.$element.unbind(transitionEnd)
+ hideModal.call(that)
+ }, 500)
+
+ this.$element.one(transitionEnd, function () {
+ clearTimeout(timeout)
+ hideModal.call(that)
+ })
+ }
+
+ function hideModal (that) {
+ this.$element
+ .hide()
+ .trigger('hidden')
+
+ backdrop.call(this)
+ }
+
function backdrop ( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if ( this.isShown && this.settings.backdrop ) {
var doAnimate = $.support.transition && animate
@@ -160,20 +175,21 @@
callback()
} else if ( !this.isShown && this.$backdrop ) {
this.$backdrop.removeClass('in')
- function removeElement() {
- that.$backdrop.remove()
- that.$backdrop = null
- }
-
$.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one(transitionEnd, removeElement) :
- removeElement()
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
+ removeBackdrop.call(this)
+
} else if ( callback ) {
callback()
}
+ }
+
+ function removeBackdrop() {
+ this.$backdrop.remove()
+ this.$backdrop = null
}
function escape() {
var that = this
if ( this.isShown && this.settings.keyboard ) {