Issue Bug Closed

#103698RTE does not allow empty attributes for the tag "a"

Timo Webler 04/22/24, 09:48 updated 07/09/24, 15:35

Description

The method \TYPO3\CMS\Core\Html\RteHtmlParser::TS_links_db remove all empty attributes from the tag “a”.

This is needed to set the attribute download,. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download

Possible solution.

Index: sysext/core/Classes/Html/RteHtmlParser.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sysext/core/Classes/Html/RteHtmlParser.php b/sysext/core/Classes/Html/RteHtmlParser.php
--- a/sysext/core/Classes/Html/RteHtmlParser.php    
+++ b/sysext/core/Classes/Html/RteHtmlParser.php    (date 1713779033389)
@@ -356,7 +356,7 @@
                     $tagAttributes['href'] = $linkInformation['href'] ?? $tagAttributes['href'];
                 }

-                $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true) . '>'
+                $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true, true) . '>'
                     . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . '</a>';
             }
         }

Reviews 2