fix: Fix checking for patchTarget in initAdoptedStyleSheetObserver (#1327)

This commit is contained in:
Francesco Novy
2026-04-01 12:00:00 +08:00
committed by GitHub
parent db334d2405
commit cd577d4d1d
2 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
'rrweb': patch
---
fix: Fix checking for `patchTarget` in `initAdoptedStyleSheetObserver`

View File

@@ -900,10 +900,12 @@ export function initAdoptedStyleSheetObserver(
host.nodeName === '#document' host.nodeName === '#document'
? (host as Document).defaultView?.Document ? (host as Document).defaultView?.Document
: host.ownerDocument?.defaultView?.ShadowRoot; : host.ownerDocument?.defaultView?.ShadowRoot;
const originalPropertyDescriptor = Object.getOwnPropertyDescriptor( const originalPropertyDescriptor = patchTarget?.prototype
patchTarget?.prototype, ? Object.getOwnPropertyDescriptor(
'adoptedStyleSheets', patchTarget?.prototype,
); 'adoptedStyleSheets',
)
: undefined;
if ( if (
hostId === null || hostId === null ||
hostId === -1 || hostId === -1 ||