aboutsummaryrefslogtreecommitdiff
path: root/js/button.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-12-14 16:20:19 -0800
committerMark Otto <[email protected]>2013-12-14 16:20:19 -0800
commit83c60ef3eec234b3dac94c841fd1f13f94aab36f (patch)
tree0d896dedbbd47723ab769b139b63a5a58778e578 /js/button.js
parent3bfa630d2afe70452861b2466daab78daa47dda8 (diff)
parent4afcebe0e71aafd0cfb501548a6591effdbe2e70 (diff)
downloadbootstrap-83c60ef3eec234b3dac94c841fd1f13f94aab36f.tar.xz
bootstrap-83c60ef3eec234b3dac94c841fd1f13f94aab36f.zip
Merge branch 'master' into pr/11107
Conflicts: docs-assets/js/raw-files.js
Diffstat (limited to 'js/button.js')
-rw-r--r--js/button.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/js/button.js b/js/button.js
index fc73b555f..6c66960d8 100644
--- a/js/button.js
+++ b/js/button.js
@@ -1,6 +1,6 @@
/* ========================================================================
- * Bootstrap: button.js v3.0.0
- * http://twbs.github.com/bootstrap/javascript.html#buttons
+ * Bootstrap: button.js v3.0.3
+ * http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
@@ -18,7 +18,7 @@
* ======================================================================== */
-+function ($) { "use strict";
++function ($) { 'use strict';
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
@@ -54,15 +54,21 @@
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons"]')
+ var changed = true
if ($parent.length) {
var $input = this.$element.find('input')
- .prop('checked', !this.$element.hasClass('active'))
- .trigger('change')
- if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
+ if ($input.prop('type') === 'radio') {
+ // see if clicking on current one
+ if ($input.prop('checked') && this.$element.hasClass('active'))
+ changed = false
+ else
+ $parent.find('.active').removeClass('active')
+ }
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}
- this.$element.toggleClass('active')
+ if (changed) this.$element.toggleClass('active')
}
@@ -106,4 +112,4 @@
e.preventDefault()
})
-}(window.jQuery);
+}(jQuery);