diff options
| author | Mark Otto <[email protected]> | 2013-12-01 20:27:30 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-01 20:27:30 -0800 |
| commit | 4876cbeef8c79686ba31c3ed22771357d71dbe51 (patch) | |
| tree | 79fed0fbb2a96fad2247c3014a045e655d1a825e /js/button.js | |
| parent | 1444a3ca638bd8661c0019560117ac75aace3402 (diff) | |
| parent | 561aff7942d9adfc9508232789e2598406f80934 (diff) | |
| download | bootstrap-4876cbeef8c79686ba31c3ed22771357d71dbe51.tar.xz bootstrap-4876cbeef8c79686ba31c3ed22771357d71dbe51.zip | |
Merge branch 'master' into pr/11412
Conflicts:
dist/js/bootstrap.min.js
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/js/button.js b/js/button.js index 0145689dd..c9fdde5e4 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. @@ -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') } |
