Skip to content

Commit 0f10265

Browse files
fix: span css colors normalization
1 parent 5d3b8eb commit 0f10265

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/web/normalization/htmlNormalizer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,11 @@ function walkNode(node: Node, out: { buf: string }): void {
500500

501501
// <span>: CSS style → inline tags
502502
if (name === 'span') {
503-
const rawStyle = node.getAttribute('style') || '';
504-
const s = parseCssStyle(rawStyle);
503+
const htmlNode = node as HTMLElement;
504+
const s = parseCssStyle(node.getAttribute('style'));
505505

506-
const fg = findCssValue(rawStyle, 'color');
507-
const bg = findCssValue(rawStyle, 'background-color');
506+
const fg = htmlNode.style.color;
507+
const bg = htmlNode.style.backgroundColor;
508508

509509
// build the preserved span if colors exist
510510
let spanOpen = '';

0 commit comments

Comments
 (0)