Issue Bug Closed

#78844HTML5: use self-closing tags only if allowed

Markus Mächler 11/30/16, 15:50 updated 10/02/18, 11:04

Description

In the frontend rendering of RTE content, empty tags should only be converted to self-closing tags if allowed by the HTML5 standard.
The Problem ist that e.g.

<a id=“myspecialanchor”></a>

is converted to

<a id=“myspecialanchor” />

which will result in the subsequent content being rendered as a link, too (at least in Google Chrome).

This Problem exists in TYPO3 7.6 and 8.

This is because only specific tags may be self-closing according to the HTML5 specification:

https://www.w3.org/TR/html5/syntax.html#void-elements

Void elements: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr

The following line should be fixed:

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4964

Moreover, the a notice should be added to the todo-comment in following line

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4074

Reviews 3