From 778b22dc8163fbf9c5bb4b5ed16857b297e52fb6 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Tue, 29 Jun 2021 18:37:49 +0800 Subject: [PATCH] format code --- src/rebuild.ts | 6 +++--- src/snapshot.ts | 6 +++--- src/types.ts | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/rebuild.ts b/src/rebuild.ts index ecf94cc5..c9322536 100644 --- a/src/rebuild.ts +++ b/src/rebuild.ts @@ -154,7 +154,7 @@ function buildNode( node.appendChild(child); continue; } - + try { if (n.isSVG && name === 'xlink:href') { node.setAttributeNS('http://www.w3.org/1999/xlink', name, value); @@ -269,7 +269,7 @@ export function buildNodeWithSN( } if (n.rootId) { console.assert( - (map[n.rootId] as unknown as Document) === doc, + ((map[n.rootId] as unknown) as Document) === doc, 'Target document should has the same root id.', ); } @@ -332,7 +332,7 @@ function handleScroll(node: INode) { if (n.type !== NodeType.Element) { return; } - const el = node as Node as HTMLElement; + const el = (node as Node) as HTMLElement; for (const name in n.attributes) { if (!(n.attributes.hasOwnProperty(name) && name.startsWith('rr_'))) { continue; diff --git a/src/snapshot.ts b/src/snapshot.ts index 2a80d755..7e5da9e3 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -362,12 +362,12 @@ function serializeNode( maskInputOptions = {}, maskTextFn, recordCanvas, - keepIframeSrcFn + keepIframeSrcFn, } = options; // Only record root id when document object is not the base document let rootId: number | undefined; - if ((doc as unknown as INode).__sn) { - const docId = (doc as unknown as INode).__sn.id; + if (((doc as unknown) as INode).__sn) { + const docId = ((doc as unknown) as INode).__sn.id; rootId = docId === 1 ? undefined : docId; } switch (n.nodeType) { diff --git a/src/types.ts b/src/types.ts index 9b2a6286..baa52211 100644 --- a/src/types.ts +++ b/src/types.ts @@ -110,4 +110,3 @@ export type SlimDOMOptions = Partial<{ export type MaskTextFn = (text: string) => string; export type KeepIframeSrcFn = (src: string) => boolean; -