js/bootstrap-button.js in twitter-bootstrap-ruby-2.1.1.0 vs js/bootstrap-button.js in twitter-bootstrap-ruby-2.3.1.0

- old
+ new

@@ -1,7 +1,7 @@ /* ============================================================ - * bootstrap-button.js v2.1.1 + * bootstrap-button.js v2.3.1 * http://twitter.github.com/bootstrap/javascript.html#buttons * ============================================================ * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,10 +62,12 @@ /* BUTTON PLUGIN DEFINITION * ======================== */ + var old = $.fn.button + $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') , options = typeof option == 'object' && option @@ -80,17 +82,24 @@ } $.fn.button.Constructor = Button + /* BUTTON NO CONFLICT + * ================== */ + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + /* BUTTON DATA-API * =============== */ - $(function () { - $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { - var $btn = $(e.target) - if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') - $btn.button('toggle') - }) + $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') }) }(window.jQuery); \ No newline at end of file