From 4d900be420d56e57b846a023ecde5c76d6967d6a Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 20 Feb 2023 15:23:32 +0100 Subject: [PATCH] fix: more robust `rootShadowHost` check (#50) This _may_ be the underlying cause [here](https://sentry.sentry.io/issues/3725692470/?project=11276&referrer=assigned_activity-email), maybe an e.g. `undefined` sneaked in there somehow. IMHO this should also safe some bytes. --- packages/rrweb/src/record/mutation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/mutation.ts b/packages/rrweb/src/record/mutation.ts index ac8c0b3a52..fc7ed63131 100644 --- a/packages/rrweb/src/record/mutation.ts +++ b/packages/rrweb/src/record/mutation.ts @@ -282,7 +282,7 @@ export default class MutationBuffer { // ensure shadowHost is a Node, or doc.contains will throw an error const notInDoc = !this.doc.contains(n) && - (rootShadowHost === null || !this.doc.contains(rootShadowHost)); + (!rootShadowHost || !this.doc.contains(rootShadowHost)); if (!n.parentNode || notInDoc) { return; }