fix block strategy
If an element was blocked, its child nodes should also be blocked. The interactions and mutations on the element and its child nodes also need to be blocked.
This commit is contained in:
14
src/utils.ts
14
src/utils.ts
@@ -112,3 +112,17 @@ export function getWindowWidth(): number {
|
||||
(document.body && document.body.clientWidth)
|
||||
);
|
||||
}
|
||||
|
||||
const BLOCK_CLASS = 'rr-block';
|
||||
export function isBlocked(node: Node | null): boolean {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
if (node.nodeType === node.ELEMENT_NODE) {
|
||||
return (
|
||||
(node as HTMLElement).classList.contains(BLOCK_CLASS) ||
|
||||
isBlocked(node.parentNode)
|
||||
);
|
||||
}
|
||||
return isBlocked(node.parentNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user