From add09366dc2dffa7c87a2fc5a7a2ea6267ca6ce5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 16 Jun 2021 14:08:27 +0200 Subject: [PATCH] Revert "Strip the `loading` attribute from smileys for AMP output" This reverts commit 4cfc175da480a13704dd6b52e49723c9a84cb62d. --- wcfsetup/install/files/lib/data/smiley/Smiley.class.php | 7 ++----- .../system/html/output/node/HtmlOutputNodeImg.class.php | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php index 4518cca9c7..20bc1a7726 100644 --- a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php +++ b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php @@ -128,10 +128,9 @@ class Smiley extends DatabaseObject implements ITitledObject * Returns the html code to render the smiley. * * @param string $class (additional) class(es) of the smiley element - * @param bool $isAmp * @return string */ - public function getHtml($class = '', $isAmp = false) + public function getHtml($class = '') { $srcset = ($this->smileyPath2x) ? ' srcset="' . StringUtil::encodeHTML($this->getURL2x()) . ' 2x"' : ''; $height = ($this->getHeight()) ? ' height="' . $this->getHeight() . '"' : ''; @@ -140,8 +139,6 @@ class Smiley extends DatabaseObject implements ITitledObject $class = ' ' . $class; } - $loading = ($isAmp) ? '' : ' loading="eager"'; - - return '' . StringUtil::encodeHTML($this->smileyCode) . ''; + return '' . StringUtil::encodeHTML($this->smileyCode) . ''; } } diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php index b209137180..72e1968c69 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeImg.class.php @@ -36,8 +36,6 @@ class HtmlOutputNodeImg extends AbstractHtmlOutputNode */ public function process(array $elements, AbstractHtmlNodeProcessor $htmlNodeProcessor) { - $isAmp = ($htmlNodeProcessor instanceof AmpHtmlOutputNodeProcessor); - /** @var \DOMElement $element */ foreach ($elements as $element) { $class = $element->getAttribute('class'); @@ -52,7 +50,7 @@ class HtmlOutputNodeImg extends AbstractHtmlOutputNode } else { // Ensure that the smiley's HTML is up to date. $doc = new \DOMDocument(); - $doc->loadHTML($smiley->getHtml('', $isAmp)); + $doc->loadHTML($smiley->getHtml()); $smileyNode = $element->ownerDocument->importNode($doc->getElementsByTagName('img')->item(0), true); $element->parentNode->replaceChild($smileyNode, $element); } -- 2.20.1