Fixed handling of empty bbcodes
authorAlexander Ebert <ebert@woltlab.com>
Thu, 22 Jun 2017 09:21:54 +0000 (11:21 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 22 Jun 2017 09:22:01 +0000 (11:22 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php

index a7fa114349e4867b8d34a2dff266ce62d0dbaec0..1d40f249fa2f7ce91b6e16528ca810e2a44f1fc7 100644 (file)
@@ -390,7 +390,11 @@ class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode {
                                
                                if ($element !== $endAncestor) {
                                        if ($this->isBlockElement($element)) {
-                                               $this->wrapContent($name, $attributes, $element->firstChild, null);
+                                               if ($element->childNodes->length === 0) {
+                                                       $element->appendChild($element->ownerDocument->createTextNode(''));
+                                               }
+                                               
+                                               $this->wrapContent($name, $attributes, $element->childNodes->item(0), null);
                                        }
                                        else {
                                                $this->wrapContent($name, $attributes, $element, null);