From: Alexander Ebert Date: Mon, 12 Apr 2021 20:14:20 +0000 (+0200) Subject: Use `XPath::query()` for its superior performance X-Git-Tag: 5.3.6~9^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eba1a94b4f1c9f8ea72ee5a9083ee28ca89ee157;p=GitHub%2FWoltLab%2FWCF.git Use `XPath::query()` for its superior performance --- diff --git a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php index 6e4cf72229..e07b677798 100644 --- a/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php @@ -283,7 +283,7 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor { } $elements = []; - foreach ($this->getDocument()->getElementsByTagName($tagName) as $element) { + foreach ($this->getXPath()->query("//{$tagName}") as $element) { $elements[] = $element; } diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php index d2e54f1740..9ac423ce51 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php @@ -98,7 +98,6 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor { if ($this->outputType !== 'text/html') { // convert `

...

` into `...

` - $paragraphs = []; foreach ($this->getXPath()->query('//p') as $paragraph) { $isLastNode = true; $sibling = $paragraph;