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
path: root/js/src/util
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2021-07-30 09:28:51 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-10-05 19:52:11 +0300
commit666fe596bf4629777f995dd79046b1db632ffdfb (patch)
tree9e14fcf9c5d325e668d75d2b313242e16e7fbec3 /js/src/util
parent2b4d0d166b58cabfb0384a2081d84e51df84e37f (diff)
Enable `unicorn/no-array-for-each` rule
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/index.js8
-rw-r--r--js/src/util/sanitizer.js4
-rw-r--r--js/src/util/scrollbar.js4
3 files changed, 10 insertions, 6 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js
index b994963018..9cee979dfc 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -125,7 +125,7 @@ const getElement = obj => {
}
const typeCheckConfig = (componentName, config, configTypes) => {
- Object.keys(configTypes).forEach(property => {
+ for (const property of Object.keys(configTypes)) {
const expectedTypes = configTypes[property]
const value = config[property]
const valueType = value && isElement(value) ? 'element' : toType(value)
@@ -135,7 +135,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
)
}
- })
+ }
}
const isVisible = element => {
@@ -217,7 +217,9 @@ const onDOMContentLoaded = callback => {
// add listener on the first call when the document is in loading state
if (!DOMContentLoadedCallbacks.length) {
document.addEventListener('DOMContentLoaded', () => {
- DOMContentLoadedCallbacks.forEach(callback => callback())
+ for (const callback of DOMContentLoadedCallbacks) {
+ callback()
+ }
})
}
diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js
index c02a4eb906..e27961e9a3 100644
--- a/js/src/util/sanitizer.js
+++ b/js/src/util/sanitizer.js
@@ -114,11 +114,11 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
const attributeList = [].concat(...element.attributes)
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])
- attributeList.forEach(attribute => {
+ for (const attribute of attributeList) {
if (!allowedAttribute(attribute, allowedAttributes)) {
element.removeAttribute(attribute.nodeName)
}
- })
+ }
}
return createdDocument.body.innerHTML
diff --git a/js/src/util/scrollbar.js b/js/src/util/scrollbar.js
index 2d5d0ffa65..f9a2d992dd 100644
--- a/js/src/util/scrollbar.js
+++ b/js/src/util/scrollbar.js
@@ -85,7 +85,9 @@ class ScrollBarHelper {
if (isElement(selector)) {
callBack(selector)
} else {
- SelectorEngine.find(selector, this._element).forEach(callBack)
+ for (const sel of SelectorEngine.find(selector, this._element)) {
+ callBack(sel)
+ }
}
}