Potential cycle
bvaughn opened this issue · comments
Brian Vaughn commented
This code has a potential cycle in it:
Lines 94 to 110 in 4ac3037
Context:
toeverything/blocksuite#6471 (comment)
I think this change fixes the cycle:
- // @ts-ignore
- return node.parentNode?.host || node.parentNode;
+ const { parentNode } = node;
+ if (parentNode && parentNode instanceof ShadowRoot) {
+ return parentNode.host
+ }
+ return parentNode;