Fix: isBlocked throws on invalid HTML element (#1032)

This commit is contained in:
dbseel
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 7f5310aaec
commit e91433bb66

View File

@@ -235,7 +235,7 @@ export function isBlocked(
if (classMatchesRegex(el, blockClass, checkAncestors)) return true;
}
if (blockSelector) {
if ((node as HTMLElement).matches(blockSelector)) return true;
if (el.matches(blockSelector)) return true;
if (checkAncestors && el.closest(blockSelector) !== null) return true;
}
return false;