aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-button.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-04-24 02:21:45 -0700
committerJacob Thornton <[email protected]>2012-04-24 02:21:45 -0700
commite659dc7e1be2e09cec34703dce8c737496e3504e (patch)
treebe3caed12a3de1218e1fd548f2564302e6c8193a /js/bootstrap-button.js
parent6506ede6323ee60d4d7f8171937d92141a64e09e (diff)
parent839ef3a030b355d0f0c35d6c9e42ecba8b072036 (diff)
downloadbootstrap-e659dc7e1be2e09cec34703dce8c737496e3504e.tar.xz
bootstrap-e659dc7e1be2e09cec34703dce8c737496e3504e.zip
Merge branch '2.0.3-wip'
Conflicts: Makefile docs/assets/js/bootstrap.js docs/assets/js/bootstrap.min.js
Diffstat (limited to 'js/bootstrap-button.js')
-rw-r--r--js/bootstrap-button.js62
1 files changed, 29 insertions, 33 deletions
diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js
index 6b36753d8..a9e6ba7b1 100644
--- a/js/bootstrap-button.js
+++ b/js/bootstrap-button.js
@@ -1,5 +1,5 @@
/* ============================================================
- * bootstrap-button.js v2.0.2
+ * bootstrap-button.js v2.0.3
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2012 Twitter, Inc.
@@ -17,58 +17,54 @@
* limitations under the License.
* ============================================================ */
-!function( $ ){
- "use strict"
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
- var Button = function ( element, options ) {
+ var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
- Button.prototype = {
-
- constructor: Button
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ , $el = this.$element
+ , data = $el.data()
+ , val = $el.is('input') ? 'val' : 'html'
- , setState: function ( state ) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
+ state = state + 'Text'
+ data.resetText || $el.data('resetText', $el[val]())
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
+ $el[val](data[state] || this.options[state])
- $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)
- }
-
- , toggle: function () {
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
+ // 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)
+ }
- $parent && $parent
- .find('.active')
- .removeClass('active')
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
- this.$element.toggleClass('active')
- }
+ $parent && $parent
+ .find('.active')
+ .removeClass('active')
+ this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
- $.fn.button = function ( option ) {
+ $.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
@@ -97,4 +93,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file