format code

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 9110664ca2
commit 63cec44c10
3 changed files with 6 additions and 7 deletions

View File

@@ -154,7 +154,7 @@ function buildNode(
node.appendChild(child); node.appendChild(child);
continue; continue;
} }
try { try {
if (n.isSVG && name === 'xlink:href') { if (n.isSVG && name === 'xlink:href') {
node.setAttributeNS('http://www.w3.org/1999/xlink', name, value); node.setAttributeNS('http://www.w3.org/1999/xlink', name, value);
@@ -269,7 +269,7 @@ export function buildNodeWithSN(
} }
if (n.rootId) { if (n.rootId) {
console.assert( 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.', 'Target document should has the same root id.',
); );
} }
@@ -332,7 +332,7 @@ function handleScroll(node: INode) {
if (n.type !== NodeType.Element) { if (n.type !== NodeType.Element) {
return; return;
} }
const el = node as Node as HTMLElement; const el = (node as Node) as HTMLElement;
for (const name in n.attributes) { for (const name in n.attributes) {
if (!(n.attributes.hasOwnProperty(name) && name.startsWith('rr_'))) { if (!(n.attributes.hasOwnProperty(name) && name.startsWith('rr_'))) {
continue; continue;

View File

@@ -362,12 +362,12 @@ function serializeNode(
maskInputOptions = {}, maskInputOptions = {},
maskTextFn, maskTextFn,
recordCanvas, recordCanvas,
keepIframeSrcFn keepIframeSrcFn,
} = options; } = options;
// Only record root id when document object is not the base document // Only record root id when document object is not the base document
let rootId: number | undefined; let rootId: number | undefined;
if ((doc as unknown as INode).__sn) { if (((doc as unknown) as INode).__sn) {
const docId = (doc as unknown as INode).__sn.id; const docId = ((doc as unknown) as INode).__sn.id;
rootId = docId === 1 ? undefined : docId; rootId = docId === 1 ? undefined : docId;
} }
switch (n.nodeType) { switch (n.nodeType) {

View File

@@ -110,4 +110,3 @@ export type SlimDOMOptions = Partial<{
export type MaskTextFn = (text: string) => string; export type MaskTextFn = (text: string) => string;
export type KeepIframeSrcFn = (src: string) => boolean; export type KeepIframeSrcFn = (src: string) => boolean;