Strip dummy paragraphs
authorAlexander Ebert <ebert@woltlab.com>
Wed, 16 Nov 2016 14:30:50 +0000 (15:30 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 16 Nov 2016 15:14:14 +0000 (16:14 +0100)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php

index 55d4880fc0a30f3d0c05646789749c2635ed5775..34bb064d41102c3094beda8fac9c4a1e6f501dcf 100644 (file)
@@ -239,6 +239,14 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor {
                        }
                }
                
+               // strip empty <p></p> (zero content, not even whitespaces)
+               $paragraphs = DOMUtil::getElements($this->getDocument(), 'p');
+               foreach ($paragraphs as $paragraph) {
+                       if ($paragraph->childNodes->length === 0) {
+                               DOMUtil::removeNode($paragraph);
+                       }
+               }
+               
                // trim <p>...</p>
                /** @var \DOMElement $paragraph */
                foreach ($this->getDocument()->getElementsByTagName('p') as $paragraph) {