From eba1a94b4f1c9f8ea72ee5a9083ee28ca89ee157 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 12 Apr 2021 22:14:20 +0200 Subject: [PATCH] Use `XPath::query()` for its superior performance --- .../lib/system/html/node/AbstractHtmlNodeProcessor.class.php | 2 +- .../system/html/output/node/HtmlOutputNodeProcessor.class.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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; -- 2.20.1