From a6d2ed917edde6dffdf1ced674969712171c1ed3 Mon Sep 17 00:00:00 2001 From: Yun Feng Date: Wed, 8 Nov 2023 01:26:13 +1100 Subject: [PATCH] Feat: Add support for replaying :defined pseudo-class of custom elements (#1155) * Feat: Add support for replaying :defined pseudo-class of custom elements * add isCustom flag to serialized elements Applying Justin's review suggestion * fix code lint error * add custom element event * fix: tests (#1348) * Update packages/rrweb/src/record/observer.ts * Update packages/rrweb/src/record/observer.ts --------- Co-authored-by: Nafees Nehar Co-authored-by: Justin Halsall --- packages/rrweb/src/record/iframe-manager.ts | 1 - packages/rrweb/src/record/observer.ts | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/rrweb/src/record/iframe-manager.ts b/packages/rrweb/src/record/iframe-manager.ts index 616c137856..d3c81d2a85 100644 --- a/packages/rrweb/src/record/iframe-manager.ts +++ b/packages/rrweb/src/record/iframe-manager.ts @@ -271,7 +271,6 @@ export class IframeManager implements IframeManagerInterface { } } } - return false; } diff --git a/packages/rrweb/src/record/observer.ts b/packages/rrweb/src/record/observer.ts index e975062144..1174c8e1ce 100644 --- a/packages/rrweb/src/record/observer.ts +++ b/packages/rrweb/src/record/observer.ts @@ -1242,12 +1242,8 @@ function initCustomElementObserver({ customElementCb, }: observerParam): listenerHandler { const win = doc.defaultView as IWindow; - if (!win || !win.customElements) { - return () => { - // do nothing - }; - } - + // eslint-disable-next-line @typescript-eslint/no-empty-function + if (!win || !win.customElements) return () => {}; const restoreHandler = patch( win.customElements, 'define',