diff options
| author | Mark Otto <[email protected]> | 2013-12-14 16:56:56 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-14 16:56:56 -0800 |
| commit | 46c3d27468accdf98dd49257f17bdc507890a1c6 (patch) | |
| tree | 9067b23767a152c8cb58f2a2d24bf1276e407e5b /js/button.js | |
| parent | aad447e29075b52a46931be17a9be4016cc89ef1 (diff) | |
| parent | 4c64c1eecdb52d943a50d2c181aeb915a3caed34 (diff) | |
| download | bootstrap-46c3d27468accdf98dd49257f17bdc507890a1c6.tar.xz bootstrap-46c3d27468accdf98dd49257f17bdc507890a1c6.zip | |
Merge branch 'master' into pr/11435
Conflicts:
dist/css/bootstrap.css
dist/css/bootstrap.min.css
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/js/button.js b/js/button.js index 0145689dd..6c66960d8 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.0.2 + * 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') } |
