Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/alert.js')
-rw-r--r--js/src/alert.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/js/src/alert.js b/js/src/alert.js
index b337fbc577..f3b4245afa 100644
--- a/js/src/alert.js
+++ b/js/src/alert.js
@@ -7,6 +7,7 @@
import {
getjQuery,
+ onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd,
getElementFromSelector,
@@ -146,8 +147,6 @@ class Alert {
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))
-const $ = getjQuery()
-
/**
* ------------------------------------------------------------------------
* jQuery
@@ -155,15 +154,18 @@ const $ = getjQuery()
* add .alert to jQuery only if jQuery is present
*/
-/* istanbul ignore if */
-if ($) {
- const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Alert.jQueryInterface
- $.fn[NAME].Constructor = Alert
- $.fn[NAME].noConflict = () => {
- $.fn[NAME] = JQUERY_NO_CONFLICT
- return Alert.jQueryInterface
+onDOMContentLoaded(() => {
+ const $ = getjQuery()
+ /* istanbul ignore if */
+ if ($) {
+ const JQUERY_NO_CONFLICT = $.fn[NAME]
+ $.fn[NAME] = Alert.jQueryInterface
+ $.fn[NAME].Constructor = Alert
+ $.fn[NAME].noConflict = () => {
+ $.fn[NAME] = JQUERY_NO_CONFLICT
+ return Alert.jQueryInterface
+ }
}
-}
+})
export default Alert