]> git.mxchange.org Git - friendica.git/commitdiff
Ensure trimmed HTML nodes are text nodes in HTML::toBBCode
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 7 Aug 2019 01:22:19 +0000 (21:22 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 7 Aug 2019 01:22:19 +0000 (21:22 -0400)
src/Content/Text/HTML.php

index 688895da92f2718f6aaf3f9ad72caecdb85e2316..c8bed0b9d69e03b53f5fab1be5ec7b06988e191f 100644 (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);
                                                }