impl #23 add custom privacy selectors

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 7380e599c8
commit d1b32e6e9d
7 changed files with 60 additions and 32 deletions

View File

@@ -113,18 +113,17 @@ export function getWindowWidth(): number {
);
}
const BLOCK_CLASS = 'rr-block';
export function isBlocked(node: Node | null): boolean {
export function isBlocked(node: Node | null, blockClass: string): boolean {
if (!node) {
return false;
}
if (node.nodeType === node.ELEMENT_NODE) {
return (
(node as HTMLElement).classList.contains(BLOCK_CLASS) ||
isBlocked(node.parentNode)
(node as HTMLElement).classList.contains(blockClass) ||
isBlocked(node.parentNode, blockClass)
);
}
return isBlocked(node.parentNode);
return isBlocked(node.parentNode, blockClass);
}
export function isAncestorRemoved(target: INode): boolean {