#98463Nu HTML Validator (the one from validator.w3.org) changed how they validate self-closing tags
Description
This seems to have been a very recent change, and it causes the validator at validator.w3.org now to warn about a lot of self-closing tags, that should no longer be self-closing.
https://github.com/validator/validator/issues/1430
Mostly affected are instances of <img>, <br>, <link> and <meta>
The canonical <link> ag generated by EXT:seo seems to add />, and all tags added by the TYPO3 MetaTag generators seem to add /> as well, and I couldn’t find a way to prevent that, without having to xclass or similar unpretty solutions.
The TagBuilder, used by e.g. the <f:image> ViewHelper also adds /> on self-closing tags.. which is probably a bit harder to solve, as the TagBuilder could potentially represent any tag.
<br /> tags, output by the RTE are also affected. Not sure if it’s possible to prevent that here with some parseFunc setting.
Greetings
Reviews 1
Related issues 2
History 9
-
Lars Peter Søndergaard commented 09/28/22, 13:09
-
Chris Müller changed Related to #99497 01/09/23, 15:53
-
Luc Muller commented 01/25/23, 08:09
+1 on this issue.
I can have a fully valid code but the self closing tags sends info notice on the validator and this can be easily improved.Here’s the explanations :
https://github.com/validator/validator/wiki/Markup-%C2%BB-Void-elements#trailing-slashes-in-void-element-start-tags-do-not-mark-the-start-tags-as-self-closing
https://github.com/validator/validator/wiki/Markup-%C2%BB-Void-elements#trailing-slashes-directly-preceded-by-unquoted-attribute-values -
Rémy DANIEL commented 01/26/23, 09:56
The rendering of tags should depends on if the document is a xml document and on the html doctype.
Some enhancements have been done recently: see https://github.com/TYPO3/typo3/blob/569724111c8d04b9fca2119f1c454e0ac17021d4/typo3/sysext/core/Classes/Type/DocType.php#L114 and its usage.
But the TagBuilder still needs to adapt: https://github.com/TYPO3/Fluid/blob/c4c625884f6486afd8fb0ae7fc190b14051dc40c/src/Core/ViewHelper/TagBuilder.php#L255
-
Oliver Schröder commented 04/08/23, 12:09
The Fluid view helper format.nl2br should be updated too. It uses the PHP function nl2br() which renders
by default. -
Heinz Schilling commented and changed TYPO3 Version
1112 05/27/24, 11:30Still reproducable in 12.4.15
-
Lars Peter Søndergaard commented 04/01/25, 08:56
This issue might still be a nice-to-have feature, but I wanted to point out, that the validator has change the level from “Warning” to “Info” (quite some time ago actually)
https://github.com/validator/validator/issues/1433#issuecomment-1269507818
So the issue could be closed, but It would still be great if there was a fix in the future to disable trailing slashes on void elements.
Greetings
LPS -
Garvin Hicking changed Related to #105787 04/03/25, 20:41
-
Garvin Hicking commented and changed status
NewClosed 04/03/25, 20:42I think this should be done with https://review.typo3.org/c/Packages/TYPO3.CMS/+/87394
If I mixed something up please let me know and I’ll reopen.
Lars Peter Søndergaard wrote:
> This seems to have been a very recent change, and it causes the validator at validator.w3.org now to warn about a lot of self-closing tags, that should no longer be self-closing.
(How do I edit)
This was bad wording on my part. Should be: “warn about a lot of self-closing tags with trailing
/>, that no longer should have that trailing/”