diff options
| author | Chris Rebert <[email protected]> | 2013-11-05 22:20:29 -0800 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2013-11-10 17:25:17 -0800 |
| commit | 7a3f41b11b15f4b931aa43cf1a2fd7a00db6f817 (patch) | |
| tree | 61bc32a87d9439acdcf2b6bc2dd049b566f645ce /dist/js/bootstrap.js | |
| parent | 5d6e9212a642430719702ead322103e19c6aa782 (diff) | |
| download | bootstrap-7a3f41b11b15f4b931aa43cf1a2fd7a00db6f817.tar.xz bootstrap-7a3f41b11b15f4b931aa43cf1a2fd7a00db6f817.zip | |
<3 @asselin for figuring out this combo of 2 patches for #9920; re-grunt
Diffstat (limited to 'dist/js/bootstrap.js')
| -rw-r--r-- | dist/js/bootstrap.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 1c638ab44..4798d309e 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -220,15 +220,21 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" 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') } |
