1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-07-30 18:30:30 +02:00

#11464 - Fix JS noConflict mode - Refactor all plugins to use an internal reference to the jQuery plugin, because in noConflict mode you can never expect to be defined on the jQuery object

This commit is contained in:
Collin Donahue-Oponski
2014-04-21 23:03:33 -06:00
parent 9c4afc5772
commit a9f2b6ce0f
22 changed files with 415 additions and 288 deletions

View File

@@ -67,9 +67,7 @@
// 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')
@@ -82,6 +80,9 @@
})
}
var old = $.fn.button
$.fn.button = Plugin
$.fn.button.Constructor = Button
@@ -100,7 +101,7 @@
$(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()
})