Ensure trimmed HTML nodes are text nodes in HTML::toBBCode

This commit is contained in:
Hypolite Petovan 2019-08-06 21:22:19 -04:00
parent e3ce18ebcf
commit 246894f233
1 changed files with 1 additions and 1 deletions

View File

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