0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

fix declaration of alert jquery plugin only if jquery is available

This commit is contained in:
Johann-S 2017-08-24 20:50:27 +02:00 committed by XhmikosR
parent 4aef395e49
commit 3664d14908

View File

@ -21,7 +21,6 @@ const VERSION = '4.3.1'
const DATA_KEY = 'bs.alert' const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}` const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api' const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const Selector = { const Selector = {
DISMISS : '[data-dismiss="alert"]' 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') { if (typeof window.$ !== 'undefined' || typeof window.jQuery !== 'undefined') {
const $ = window.$ || window.jQuery const $ = window.$ || window.jQuery
$.fn[NAME] = Alert._jQueryInterface const JQUERY_NO_CONFLICT = $.fn[NAME]
$.fn[NAME].Constructor = Alert $.fn[NAME] = Alert._jQueryInterface
$.fn[NAME].noConflict = () => { $.fn[NAME].Constructor = Alert
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT $.fn[NAME] = JQUERY_NO_CONFLICT
return Alert._jQueryInterface return Alert._jQueryInterface
} }