1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 13:29:06 +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:
alpadev
2020-12-08 07:16:50 +01:00
committed by GitHub
parent 07b60d2c3e
commit 85208ae557
14 changed files with 67 additions and 167 deletions

View File

@@ -8,8 +8,7 @@
import * as Popper from '@popperjs/core'
import {
getjQuery,
onDOMContentLoaded,
defineJQueryPlugin,
TRANSITION_END,
emulateTransitionEnd,
findShadowRoot,
@@ -786,18 +785,6 @@ class Tooltip extends BaseComponent {
* add .Tooltip to jQuery only if jQuery is present
*/
onDOMContentLoaded(() => {
const $ = getjQuery()
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME]
$.fn[NAME] = Tooltip.jQueryInterface
$.fn[NAME].Constructor = Tooltip
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Tooltip.jQueryInterface
}
}
})
defineJQueryPlugin(NAME, Tooltip)
export default Tooltip