From 5915996e0abbf452904adbf7995dbeca20f6b2b6 Mon Sep 17 00:00:00 2001 From: Steve Xu Date: Tue, 14 Jan 2025 21:24:05 +0800 Subject: [PATCH] fix: undefined --- src/util/style.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/style.ts b/src/util/style.ts index cc1d7ca2..8b45a1ad 100644 --- a/src/util/style.ts +++ b/src/util/style.ts @@ -150,7 +150,7 @@ function parseStyle( styleMap: Record, style: CSSStyleDeclaration, className: string, - tagName: string, + tagName: string = '', ): Partial { let result: Partial = {}; const name = tagName.toLowerCase(); @@ -284,9 +284,9 @@ export function parseHTML(html: string) { while (temp.nodeType !== Node.TEXT_NODE) { const style = parseStyle( styleMap, - temp.style, + temp.style || {}, temp.className ? `.${temp.className}` : '', - temp.tagName, + temp.tagName || '', ); itemStyle = Object.assign(itemStyle, style); if (temp.firstChild) {