From 7cb4a255973f82eec1a0cf0ae56d55bbfb98c94c Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] using for loop instead of forEach in element classlists pick #64 and close #68 --- src/snapshot.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/snapshot.ts b/src/snapshot.ts index c01f5b2c..e5f79f35 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -183,11 +183,13 @@ export function _isBlockedElement( return true; } } 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)) { return true; } - }); + } } if (blockSelector) { return element.matches(blockSelector);