app/assets/javascripts/twitter/bootstrap/button.js in less-rails-bootstrap-3.1.1.1 vs app/assets/javascripts/twitter/bootstrap/button.js in less-rails-bootstrap-3.2.0
- old
+ new
@@ -1,7 +1,7 @@
/* ========================================================================
- * Bootstrap: button.js v3.1.1
+ * Bootstrap: button.js v3.2.0
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
@@ -17,10 +17,12 @@
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
+ Button.VERSION = '3.2.0'
+
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
@@ -29,13 +31,13 @@
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state = state + 'Text'
- if (!data.resetText) $el.data('resetText', $el[val]())
+ if (data.resetText == null) $el.data('resetText', $el[val]())
- $el[val](data[state] || this.options[state])
+ $el[val](data[state] == null ? this.options[state] : data[state])
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
if (state == 'loadingText') {
this.isLoading = true
@@ -65,13 +67,11 @@
// BUTTON PLUGIN DEFINITION
// ========================
- var old = $.fn.button
-
- $.fn.button = function (option) {
+ function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
@@ -80,10 +80,13 @@
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
+ var old = $.fn.button
+
+ $.fn.button = Plugin
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
@@ -95,13 +98,13 @@
// BUTTON DATA-API
// ===============
- $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
+ $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- $btn.button('toggle')
+ Plugin.call($btn, 'toggle')
e.preventDefault()
})
}(jQuery);