Skip to content

Commit

Permalink
Fixes niklasvh#2238 niklasvh#1624 - Fix the issue of TextNode content…
Browse files Browse the repository at this point in the history
… being overlooked in rendering due to being perceived as blank by trim().
  • Loading branch information
xweiba committed Jul 2, 2024
1 parent 6020386 commit 038ba2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dom/node-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 038ba2b

Please sign in to comment.