diff options
| author | Mark Otto <[email protected]> | 2013-12-14 16:46:40 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-14 16:46:40 -0800 |
| commit | 4c64c1eecdb52d943a50d2c181aeb915a3caed34 (patch) | |
| tree | 93b556ef583bb6a327cad76804bbdf4c5a4c6f4c /js/button.js | |
| parent | 2b56ff04614c4617355d16c14784654e841bcf4d (diff) | |
| parent | d79431ca02683c9d1c754201260f66e5dda15614 (diff) | |
| download | bootstrap-4c64c1eecdb52d943a50d2c181aeb915a3caed34.tar.xz bootstrap-4c64c1eecdb52d943a50d2c181aeb915a3caed34.zip | |
Merge branch 'master' into pr/11302
Conflicts:
dist/css/bootstrap.css
dist/css/bootstrap.min.css
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/js/button.js b/js/button.js index 44c101a2a..6c66960d8 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.0.0 + * 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); |
