Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure contains parameter is a node
  • Loading branch information
dbseel committed May 12, 2022
commit 97da83fe403097b92d04f556f0a0484dfb5c0410
4 changes: 2 additions & 2 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ export default class MutationBuffer {
rootShadowHost =
(rootShadowHost?.getRootNode?.() as ShadowRoot | undefined)?.host ||
null;
// ensure shadowHost is a Node, or doc.contains will throw an error
// ensure contains is passed a Node, or it will throw an error
const notInDoc =
!this.doc.contains(n) &&
(!rootShadowHost || !this.doc.contains(rootShadowHost));
(!rootShadowHost || (!(rootShadowHost instanceof Node) || !this.doc.contains(rootShadowHost)));
if (!n.parentNode || notInDoc) {
return;
}
Expand Down