From 8b6263ae4923ca5cff0d8241108b269b90806838 Mon Sep 17 00:00:00 2001 From: weiba Date: Wed, 17 Jul 2024 10:12:36 +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 73c968ebb..01a5794dc 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) { // The U tag marks text with a special underline treatment, and it's not possible to get the underline style from the browser's computed style. const parentStep = 3; let hasUnderline;