Skip to content

Commit

Permalink
fix: Fix checking for patchTarget in initAdoptedStyleSheetObserver (
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea authored Oct 13, 2023
1 parent 7c0dc9d commit 57a940a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-oranges-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rrweb': patch
---

fix: Fix checking for `patchTarget` in `initAdoptedStyleSheetObserver`
10 changes: 6 additions & 4 deletions packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,12 @@ export function initAdoptedStyleSheetObserver(
host.nodeName === '#document'
? (host as Document).defaultView?.Document
: host.ownerDocument?.defaultView?.ShadowRoot;
const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(
patchTarget?.prototype,
'adoptedStyleSheets',
);
const originalPropertyDescriptor = patchTarget?.prototype
? Object.getOwnPropertyDescriptor(
patchTarget?.prototype,
'adoptedStyleSheets',
)
: undefined;
if (
hostId === null ||
hostId === -1 ||
Expand Down

0 comments on commit 57a940a

Please sign in to comment.