aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-modal.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-10-29 18:49:35 -0700
committerJacob Thornton <[email protected]>2011-10-29 18:49:35 -0700
commitea50e8aeeed6616a61a7e44d28fe60ced327be0c (patch)
treec4b4e7a6c81da4145d638ede025ba14eac2f47ff /js/bootstrap-modal.js
parente8b66a9626055957a378464e2b9204f156b34c17 (diff)
downloadbootstrap-ea50e8aeeed6616a61a7e44d28fe60ced327be0c.tar.xz
bootstrap-ea50e8aeeed6616a61a7e44d28fe60ced327be0c.zip
add active class to css for buttons, write new spec for button, "use strict"
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r--js/bootstrap-modal.js37
1 files changed, 20 insertions, 17 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index 2cc910989..9c57f6ddf 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -20,6 +20,8 @@
!function( $ ){
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
@@ -115,17 +117,9 @@
.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()
+ this.$element.one(transitionEnd, $.proxy(hideModal, this)) :
+ hideModal.call(this)
return this
}
@@ -136,6 +130,14 @@
/* MODAL PRIVATE METHODS
* ===================== */
+ function hideModal (that) {
+ this.$element
+ .hide()
+ .trigger('hidden')
+
+ backdrop.call(this)
+ }
+
function backdrop ( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -162,19 +164,20 @@
} 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 ) {