From 8a68a763a58abfe6877a2f0d228bb0057e5bfb06 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 16 May 2023 15:18:25 +0200 Subject: [PATCH] Drop empty `data-attributes` for `` during input processing --- .../html/input/node/HtmlInputNodeWoltlabMetacode.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php index 84c9cffcec..310f4f8044 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php @@ -90,6 +90,13 @@ class HtmlInputNodeWoltlabMetacode extends AbstractHtmlInputNode } $attributes = $htmlNodeProcessor->parseAttributes($element->getAttribute('data-attributes')); + if ($attributes === []) { + // Drop the empty 'data-attributes' attribute. This saves some storage + // for common parameterless BBCodes and makes the edit history more useful. + // This change is safe, because a missing attribute will implicitly be + // considered to contain the empty string by ->getAttribute(). + $element->removeAttribute('data-attributes'); + } // check for converters $converter = $converters[$name] ?? null; -- 2.20.1