Try to fix removal of '<span>0</span>'

This commit is contained in:
~keith 2022-08-31 18:35:49 +00:00
parent 1e7471b71e
commit 6d065a9e48
Signed by: keith
GPG key ID: 5BEBEEAB2C73D520

View file

@ -114,7 +114,7 @@ class HTML
/** @var \DOMNode $child */ /** @var \DOMNode $child */
foreach ($node->childNodes as $key => $child) { foreach ($node->childNodes as $key => $child) {
/* Remove empty text nodes at the start or at the end of the children list */ /* Remove empty text nodes at the start or at the end of the children list */
if ($key > 0 && $key < $node->childNodes->length - 1 || $child->nodeName != '#text' || trim($child->nodeValue)) { if ($key > 0 && $key < $node->childNodes->length - 1 || $child->nodeName != '#text' || !empty(trim($child->nodeValue))) {
$newNode = $child->cloneNode(true); $newNode = $child->cloneNode(true);
$node->parentNode->insertBefore($newNode, $node); $node->parentNode->insertBefore($newNode, $node);
} }