From 679c7862374be9b742862923181302f76b3a8c06 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Tue, 24 Dec 2013 12:16:17 -0800 Subject: roll back version numbers to avoid broken links in docs and readme (fixes #12000) --- js/button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/button.js') diff --git a/js/button.js b/js/button.js index 2cf67f6ad..f9cca154a 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.1.0 + * Bootstrap: button.js v3.0.3 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2013 Twitter, Inc. -- cgit v1.2.3 From d21369c1ed97d5719f6ccf360602150fc8ed16b3 Mon Sep 17 00:00:00 2001 From: fat Date: Thu, 26 Dec 2013 19:40:18 -0800 Subject: fixes #10890 --- js/button.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'js/button.js') diff --git a/js/button.js b/js/button.js index f9cca154a..34a61f58a 100644 --- a/js/button.js +++ b/js/button.js @@ -13,8 +13,9 @@ // ============================== var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Button.DEFAULTS, options) + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false } Button.DEFAULTS = { @@ -34,25 +35,26 @@ $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d); - }, 0) + setTimeout($.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) } Button.prototype.toggle = function () { - var $parent = this.$element.closest('[data-toggle="buttons"]') var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') - 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 ($input.prop('type') == 'radio') { + 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') } -- cgit v1.2.3