Get rid of `<div>`
authorAlexander Ebert <ebert@woltlab.com>
Fri, 9 Sep 2016 14:12:50 +0000 (16:12 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 9 Sep 2016 14:12:50 +0000 (16:12 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php

index 1a121ed868a4ae520a7b7d06afb7aa67969ee248..2f29a6822b51520943405cb5e4c5308a74a2f751 100644 (file)
@@ -65,6 +65,19 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor {
         * outside of paragraphs.
         */
        protected function fixDom() {
+               // remove or convert any <div> found
+               $elements = $this->getDocument()->getElementsByTagName('div');
+               while ($elements->length) {
+                       $element = $elements->item(0);
+                       
+                       if ($element->parentNode->nodeName === 'P') {
+                               DOMUtil::removeNode($element, true);
+                       }
+                       else {
+                               DOMUtil::replaceElement($element, $element->ownerDocument->createElement('p'), true);
+                       }
+               }
+               
                $appendToPreviousParagraph = function ($node) {
                        /** @var \DOMElement $paragraph */
                        $paragraph = $node->previousSibling;