diff options
Diffstat (limited to 'js/src/toast.js')
-rw-r--r-- | js/src/toast.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/js/src/toast.js b/js/src/toast.js index 91eaba53f5..308a5d879b 100644 --- a/js/src/toast.js +++ b/js/src/toast.js @@ -7,6 +7,7 @@ import { getjQuery, + onDOMContentLoaded, TRANSITION_END, emulateTransitionEnd, getTransitionDurationFromElement, @@ -213,23 +214,25 @@ class Toast { } } -const $ = getjQuery() - /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .toast to jQuery only if jQuery is present */ -/* istanbul ignore if */ -if ($) { - const JQUERY_NO_CONFLICT = $.fn[NAME] - $.fn[NAME] = Toast.jQueryInterface - $.fn[NAME].Constructor = Toast - $.fn[NAME].noConflict = () => { - $.fn[NAME] = JQUERY_NO_CONFLICT - return Toast.jQueryInterface + +onDOMContentLoaded(() => { + const $ = getjQuery() + /* istanbul ignore if */ + if ($) { + const JQUERY_NO_CONFLICT = $.fn[NAME] + $.fn[NAME] = Toast.jQueryInterface + $.fn[NAME].Constructor = Toast + $.fn[NAME].noConflict = () => { + $.fn[NAME] = JQUERY_NO_CONFLICT + return Toast.jQueryInterface + } } -} +}) export default Toast |