From 64ceb90fdb7ca786b08cf75953df5737bb19f0bb Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 7 Jan 2017 14:23:12 +0100 Subject: [PATCH] Fixed empty spans not being stripped --- .../system/html/input/node/HtmlInputNodeProcessor.class.php | 4 ++++ .../lib/system/html/input/node/HtmlInputNodeSpan.class.php | 4 ++++ 2 files changed, 8 insertions(+) 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)) { -- 2.20.1