mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-27 05:49:07 +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:
@@ -5,7 +5,7 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import { getjQuery, onDOMContentLoaded } from './util/index'
|
||||
import { defineJQueryPlugin } from './util/index'
|
||||
import Data from './dom/data'
|
||||
import SelectorEngine from './dom/selector-engine'
|
||||
import Tooltip from './tooltip'
|
||||
@@ -165,18 +165,6 @@ class Popover extends Tooltip {
|
||||
* add .Popover to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery()
|
||||
/* istanbul ignore if */
|
||||
if ($) {
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
$.fn[NAME] = Popover.jQueryInterface
|
||||
$.fn[NAME].Constructor = Popover
|
||||
$.fn[NAME].noConflict = () => {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||
return Popover.jQueryInterface
|
||||
}
|
||||
}
|
||||
})
|
||||
defineJQueryPlugin(NAME, Popover)
|
||||
|
||||
export default Popover
|
||||
|
Reference in New Issue
Block a user