From fc2c074e5b968437f9df84832ad60ad75ea03053 Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Thu, 18 Aug 2022 13:22:50 +0200 Subject: [PATCH] now checking if skipped empty node is actually a text node --- src/Parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parser.php b/src/Parser.php index aba5809..6948b11 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -307,7 +307,7 @@ class Parser { $elm = $this->document->createElement("p"); $i = 0; foreach ($elms as $node) { - if (trim($node->textContent) === "") + if ($node->nodeName === "#text" && trim($node->textContent) === "") continue; $elm->appendChild($node); $i++;