X-Git-Url: http://git.roojs.org/?p=bootswatch;a=blobdiff_plain;f=bower_components%2Fbootstrap%2Fjs%2Fbutton.js;h=c9fdde5e488a8676cae6c22b104fae1b87efaa16;hp=0145689dded425d935db66efbc2a7fd2760b8696;hb=157ec5feff877cd918a45985ee7368e3d9d7b5b0;hpb=a081f72bd6bfc5ae255d21ba58c10fd13cd1fac1 diff --git a/bower_components/bootstrap/js/button.js b/bower_components/bootstrap/js/button.js index 0145689..c9fdde5 100644 --- a/bower_components/bootstrap/js/button.js +++ b/bower_components/bootstrap/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') }