Bug #78844

HTML5: use self-closing tags only if allowed

Added by Markus Mächler almost 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Start date:
2016-11-30
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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

Associated revisions

Revision 4830763a (diff)
Added by Esteban Marín almost 2 years ago

[BUGFIX] HTML5: use self-closing tags only if allowed

For HTML5 only certain HTML tags are allowed to be self-closing
(e.g. <img src="..." />), so this needs to be checked when
parsing HTML.

Resolves: #78844
Releases: master, 8.7
Change-Id: If2a319fa83a4baf7d78559aa23ce34903d42d342
Reviewed-on: https://review.typo3.org/50812
Tested-by: TYPO3com <>
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Jigal van Hemert <>
Tested-by: Jigal van Hemert <>

Revision 97ce5725 (diff)
Added by Esteban Marín almost 2 years ago

[BUGFIX] HTML5: use self-closing tags only if allowed

For HTML5 only certain HTML tags are allowed to be self-closing
(e.g. <img src="..." />), so this needs to be checked when
parsing HTML.

Resolves: #78844
Releases: master, 8.7
Change-Id: If2a319fa83a4baf7d78559aa23ce34903d42d342
Reviewed-on: https://review.typo3.org/55664
Reviewed-by: Jigal van Hemert <>
Tested-by: Jigal van Hemert <>

History

#1 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50812

#2 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50889

#3 Updated by Gerrit Code Review almost 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50889

#4 Updated by Gerrit Code Review almost 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50812

#5 Updated by Gerrit Code Review almost 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50889

#6 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50812

#7 Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50812

#8 Updated by Oliver Hader about 2 years ago

  • Category changed from 1050 to Frontend

#9 Updated by Gerrit Code Review almost 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50812

#10 Updated by Gerrit Code Review almost 2 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55664

#11 Updated by Anonymous almost 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#12 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF