2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03:00

Js - use a default JQueryInterface in js components

This commit is contained in:
GeoSot
2021-12-02 18:12:53 +02:00
parent 88a6610895
commit dd9f2b31d0
27 changed files with 161 additions and 239 deletions
+4 -2
View File
@@ -4,6 +4,7 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import { getJqueryInterfaceForPlugin } from './jquery-stuff'
const MAX_UID = 1_000_000
const MILLISECONDS_MULTIPLIER = 1000
@@ -235,15 +236,16 @@ const isRTL = () => document.documentElement.dir === 'rtl'
const defineJQueryPlugin = plugin => {
onDOMContentLoaded(() => {
const $ = getjQuery()
const callback = getJqueryInterfaceForPlugin(plugin)
/* istanbul ignore if */
if ($) {
const name = plugin.NAME
const JQUERY_NO_CONFLICT = $.fn[name]
$.fn[name] = plugin.jQueryInterface
$.fn[name] = callback
$.fn[name].Constructor = plugin
$.fn[name].noConflict = () => {
$.fn[name] = JQUERY_NO_CONFLICT
return plugin.jQueryInterface
return callback
}
}
})