From: Alexander Ebert Date: Mon, 12 Apr 2021 17:30:02 +0000 (+0200) Subject: Inline calls in `removeNode()` to improve the simplified-html/plain performance X-Git-Tag: 5.3.6~9^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=366af48be47c97150bc93dfdeb82171f8c3e0b6b;p=GitHub%2FWoltLab%2FWCF.git Inline calls in `removeNode()` to improve the simplified-html/plain performance --- diff --git a/wcfsetup/install/files/lib/util/DOMUtil.class.php b/wcfsetup/install/files/lib/util/DOMUtil.class.php index 238d5a1f24..f362bb9362 100644 --- a/wcfsetup/install/files/lib/util/DOMUtil.class.php +++ b/wcfsetup/install/files/lib/util/DOMUtil.class.php @@ -478,6 +478,8 @@ final class DOMUtil { * @param boolean $preserveChildNodes preserve child nodes, only supported for elements */ public static function removeNode(\DOMNode $node, $preserveChildNodes = false) { + $parent = $node->parentNode ?: $node->ownerDocument; + if ($preserveChildNodes) { if (!($node instanceof \DOMElement)) { throw new \InvalidArgumentException("Preserving child nodes is only supported for DOMElement."); @@ -489,11 +491,11 @@ final class DOMUtil { } foreach ($children as $child) { - self::insertBefore($child, $node); + $parent->insertBefore($child, $node); } } - self::getParentNode($node)->removeChild($node); + $parent->removeChild($node); } /**