1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 21:39:08 +02:00

Remove jQuery from alert.js and add .alert only if jQuery is available

This commit is contained in:
Johann-S
2017-08-23 12:03:50 +02:00
committed by XhmikosR
parent a3398fffd6
commit 2970d14dd9
5 changed files with 30 additions and 37 deletions

View File

@@ -16,9 +16,8 @@ if (!Element.prototype.matches) {
}
// closest polyfill (see: https://mzl.la/2vXggaI)
let fnClosest = null
if (!Element.prototype.closest) {
fnClosest = (element, selector) => {
Element.prototype.closest = (element, selector) => {
let ancestor = element
if (!document.documentElement.contains(element)) {
return null
@@ -34,12 +33,10 @@ if (!Element.prototype.closest) {
return null
}
} else {
fnClosest = (element, selector) => {
return element.closest(selector)
}
}
const fnClosest = Element.prototype.closest
const SelectorEngine = {
matches(element, selector) {
return fnMatches.call(element, selector)
@@ -59,7 +56,7 @@ const SelectorEngine = {
},
closest(element, selector) {
return fnClosest(element, selector)
return fnClosest.call(element, selector)
}
}