From 7b5cd25a019486f707ee1e4f28608425a2778e68 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 8 May 2023 12:09:07 +0200 Subject: [PATCH] Unify the clean up of trailing `
` in `

` and `` --- .../output/node/HtmlOutputNodeNormalizer.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php index d6c3437958..cb59e84d05 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php @@ -132,16 +132,20 @@ final class HtmlOutputNodeNormalizer private function removeTrailingBr(\DOMElement $br): void { - $paragraph = DOMUtil::closest($br, "p"); - if ($paragraph === null) { - return; + $paragraphOrTableCell = DOMUtil::closest($br, "p"); + if ($paragraphOrTableCell === null) { + $paragraphOrTableCell = DOMUtil::closest($br, "td"); + + if ($paragraphOrTableCell === null) { + return; + } } - if (!DOMUtil::isLastNode($br, $paragraph)) { + if (!DOMUtil::isLastNode($br, $paragraphOrTableCell)) { return; } - if ($paragraph->childNodes->length > 1) { + if ($paragraphOrTableCell->nodeName === "td" || $paragraphOrTableCell->childNodes->length > 1) { $br->remove(); } } -- 2.20.1