aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-11-01 07:38:55 +0200
committerGitHub <[email protected]>2020-11-01 07:38:55 +0200
commite6f8428b2850418474649006641c7fc4c0326eff (patch)
treefd81c0ec84916035020c5002fa2da4631b791962 /js/src
parentd1dcc1e5e6fa3422bf47002f7b4d07661d956ab2 (diff)
downloadbootstrap-e6f8428b2850418474649006641c7fc4c0326eff.tar.xz
bootstrap-e6f8428b2850418474649006641c7fc4c0326eff.zip
polyfill.js minor tweaks (#32011)
* rename function to `supportsScopeQuery` * use a ternary in `findOne` function return value
Diffstat (limited to 'js/src')
-rw-r--r--js/src/dom/polyfill.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/js/src/dom/polyfill.js b/js/src/dom/polyfill.js
index 55bc5d694..61e75eccd 100644
--- a/js/src/dom/polyfill.js
+++ b/js/src/dom/polyfill.js
@@ -27,7 +27,7 @@ const defaultPreventedPreservedOnDispatch = (() => {
})()
const scopeSelectorRegex = /:scope\b/
-const supportScopeQuery = (() => {
+const supportsScopeQuery = (() => {
const element = document.createElement('div')
try {
@@ -39,7 +39,7 @@ const supportScopeQuery = (() => {
return true
})()
-if (!supportScopeQuery) {
+if (!supportsScopeQuery) {
find = function (selector) {
if (!scopeSelectorRegex.test(selector)) {
return this.querySelectorAll(selector)
@@ -71,11 +71,7 @@ if (!supportScopeQuery) {
const matches = find.call(this, selector)
- if (typeof matches[0] !== 'undefined') {
- return matches[0]
- }
-
- return null
+ return matches[0] ? matches[0] : null
}
}