From 038ba2b98dc85a4133205426df6a69e150305d4a Mon Sep 17 00:00:00 2001 From: caleb_liu Date: Tue, 2 Jul 2024 13:03:14 +0800 Subject: [PATCH] Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim(). --- src/dom/node-parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dom/node-parser.ts b/src/dom/node-parser.ts index 5f38a2411..85890edb0 100644 --- a/src/dom/node-parser.ts +++ b/src/dom/node-parser.ts @@ -17,8 +17,8 @@ const LIST_OWNERS = ['OL', 'UL', 'MENU']; const parseNodeTree = (context: Context, node: Node, parent: ElementContainer, root: ElementContainer) => { for (let childNode = node.firstChild, nextNode; childNode; childNode = nextNode) { nextNode = childNode.nextSibling; - - if (isTextNode(childNode) && childNode.data.trim().length > 0) { + // Fixes #2238 #1624 - Fix the issue of TextNode content being overlooked in rendering due to being perceived as blank by trim(). + if (isTextNode(childNode) && childNode.data.length > 0) { parent.textNodes.push(new TextContainer(context, childNode, parent.styles)); } else if (isElementNode(childNode)) { if (isSlotElement(childNode) && childNode.assignedNodes) {