using for loop instead of forEach in element classlists

pick #64 and close #68
This commit is contained in:
Yanzhen Yu
2021-02-25 21:14:30 +08:00
parent dbdf58a29d
commit 8307c87ced

View File

@@ -183,11 +183,13 @@ export function _isBlockedElement(
return true; return true;
} }
} else { } else {
element.classList.forEach((className) => { // tslint:disable-next-line: prefer-for-of
for (let eIndex = 0; eIndex < element.classList.length; eIndex++) {
const className = element.classList[eIndex];
if (blockClass.test(className)) { if (blockClass.test(className)) {
return true; return true;
} }
}); }
} }
if (blockSelector) { if (blockSelector) {
return element.matches(blockSelector); return element.matches(blockSelector);