From: Johann-S Date: Thu, 24 Aug 2017 18:50:27 +0000 (+0200) Subject: fix declaration of alert jquery plugin only if jquery is available X-Git-Tag: v5.0.0-alpha1~1335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3664d14908911c803e15300f90b0659a67341f97;p=thirdparty%2Fbootstrap.git fix declaration of alert jquery plugin only if jquery is available --- diff --git a/js/src/alert.js b/js/src/alert.js index 000d7506f1..d23c4659c0 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -21,7 +21,6 @@ const VERSION = '4.3.1' const DATA_KEY = 'bs.alert' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -const JQUERY_NO_CONFLICT = $.fn[NAME] const Selector = { DISMISS : '[data-dismiss="alert"]' @@ -152,10 +151,11 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleD */ if (typeof window.$ !== 'undefined' || typeof window.jQuery !== 'undefined') { - const $ = window.$ || window.jQuery - $.fn[NAME] = Alert._jQueryInterface - $.fn[NAME].Constructor = Alert - $.fn[NAME].noConflict = () => { + const $ = window.$ || window.jQuery + 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 }