From: Alexander Ebert Date: Sat, 7 Jan 2017 13:23:12 +0000 (+0100) Subject: Fixed empty spans not being stripped X-Git-Tag: 3.0.0~22 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64ceb90fdb7ca786b08cf75953df5737bb19f0bb;p=GitHub%2FWoltLab%2FWCF.git Fixed empty spans not being stripped --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php index d129187c88..ee1f92ecf0 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php @@ -121,6 +121,10 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor { } $element->removeAttribute('class'); + + if ($nodeName === 'span' && $element->attributes->length === 0) { + DOMUtil::removeNode($element, true); + } } EventHandler::getInstance()->fireAction($this, 'beforeEmbeddedProcess'); diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeSpan.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeSpan.class.php index 901dbb689b..7e4d55ec3e 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeSpan.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeSpan.class.php @@ -30,6 +30,10 @@ class HtmlInputNodeSpan extends AbstractHtmlInputNode { public function process(array $elements, AbstractHtmlNodeProcessor $htmlNodeProcessor) { /** @var \DOMElement $element */ foreach ($elements as $element) { + if (!$element->hasAttribute('style')) { + continue; + } + $style = explode(';', $element->getAttribute('style')); for ($i = 0, $length = count($style); $i < $length; $i++) { if (preg_match('~^\s*font-size\s*:(.+)$~', $style[$i], $matches)) {