We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
node.nodeType
1 parent 833381c commit fa0ac53Copy full SHA for fa0ac53
packages/rrweb/src/utils.ts
@@ -229,11 +229,17 @@ export function closestElementOfNode(node: Node | null): HTMLElement | null {
229
if (!node) {
230
return null;
231
}
232
- const el: HTMLElement | null =
233
- node.nodeType === node.ELEMENT_NODE
234
- ? (node as HTMLElement)
235
- : node.parentElement;
236
- return el;
+
+ // Catch access to node properties to avoid Firefox "permission denied" errors
+ try {
+ const el: HTMLElement | null =
+ node.nodeType === node.ELEMENT_NODE
237
+ ? (node as HTMLElement)
238
+ : node.parentElement;
239
+ return el;
240
+ } catch (error) {
241
+ return null;
242
+ }
243
244
245
/**
0 commit comments