1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-29 14:59:16 +02:00

Enable unicorn/no-for-loop rule

This commit is contained in:
XhmikosR
2021-08-10 18:07:39 +03:00
parent 9f1579aa04
commit 2b4d0d166b
6 changed files with 15 additions and 20 deletions

View File

@@ -46,8 +46,8 @@ const allowedAttribute = (attribute, allowedAttributeList) => {
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
// Check if a regular expression validates the attribute.
for (let i = 0, len = regExp.length; i < len; i++) {
if (regExp[i].test(attributeName)) {
for (const element of regExp) {
if (element.test(attributeName)) {
return true
}
}
@@ -102,8 +102,7 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
const elements = [].concat(...createdDocument.body.querySelectorAll('*'))
for (let i = 0, len = elements.length; i < len; i++) {
const element = elements[i]
for (const element of elements) {
const elementName = element.nodeName.toLowerCase()
if (!Object.keys(allowList).includes(elementName)) {