mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-25 22:41:20 +02:00
Refactor components to use a utility function to define jQuery plugins (#32285)
* refactor: use an utility function to define jQuery plugins * test: add spec for defineJQueryPlugin utility function * Update .bundlewatch.config.json Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
import * as Popper from '@popperjs/core'
|
||||
|
||||
import {
|
||||
getjQuery,
|
||||
onDOMContentLoaded,
|
||||
defineJQueryPlugin,
|
||||
getElementFromSelector,
|
||||
isElement,
|
||||
isVisible,
|
||||
@@ -490,18 +489,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, e => e.stop
|
||||
* add .Dropdown to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery()
|
||||
/* istanbul ignore if */
|
||||
if ($) {
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
$.fn[NAME] = Dropdown.jQueryInterface
|
||||
$.fn[NAME].Constructor = Dropdown
|
||||
$.fn[NAME].noConflict = () => {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||
return Dropdown.jQueryInterface
|
||||
}
|
||||
}
|
||||
})
|
||||
defineJQueryPlugin(NAME, Dropdown)
|
||||
|
||||
export default Dropdown
|
||||
|
Reference in New Issue
Block a user