From: Alexander Ebert Date: Mon, 8 May 2023 10:09:07 +0000 (+0200) Subject: Unify the clean up of trailing `
` in `

` and `` X-Git-Tag: 6.0.0_Alpha_1~136^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7b5cd25a019486f707ee1e4f28608425a2778e68;p=GitHub%2FWoltLab%2FWCF.git Unify the clean up of trailing `
` in `

` and `` --- 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(); } }