Project

General

Profile

Actions

Bug #98463

open

Nu HTML Validator (the one from validator.w3.org) changed how they validate self-closing tags

Added by Lars Peter Søndergaard about 2 years ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-09-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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 <meta> 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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99497: HTML Validation: Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.Closed2023-01-09

Actions
Actions #1

Updated by Lars Peter Søndergaard about 2 years ago

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 /"

Actions #2

Updated by Chris Müller almost 2 years ago

  • Related to Bug #99497: HTML Validation: Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values. added
Actions #4

Updated by Rémy DANIEL almost 2 years ago

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

Actions #5

Updated by Oliver Schröder over 1 year ago

The Fluid view helper format.nl2br should be updated too. It uses the PHP function nl2br() which renders <br /> by default.

Actions #6

Updated by Heinz Schilling 6 months ago

  • TYPO3 Version changed from 11 to 12

Still reproducable in 12.4.15

Actions

Also available in: Atom PDF