Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove HTML comment in <style> elements #4111

Open
bschmalhofer opened this issue Jan 28, 2025 · 1 comment
Open

Do not remove HTML comment in <style> elements #4111

bschmalhofer opened this issue Jan 28, 2025 · 1 comment
Assignees
Labels
bug Something isn't working as intended style Beautify please
Milestone

Comments

@bschmalhofer
Copy link
Contributor

Some incoming HTML mails put the CSS in the style tag between markers for HTML comments. The intention is to support ancient browsers that do not know about the <style> tag and include the style declaration in the rendered output. In our modern times this is no longer necessary. See also https://stackoverflow.com/questions/4447531/what-is-the-usage-of-comment-notations-in-style-tag and https://www.w3.org/TR/html4/present/styles.html#h-14.5.

The problem is that the Safety() method meddles with the content and replaces the opening <!-- with &lt;--. This confuses browsers. See also #4081 which show a similar effect.

Here is an example:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">

<style><--
/* Font Definitions */
@font-face
	{font-family:Helvetica;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Aptos;}
@font-face
	{font-family:"Aptos \(Corpo\)";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
span.EstiloCorreioEletrnico64
	{mso-style-type:personal-reply;
	font-family:"Aptos (Corpo)",serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
	{page:WordSection1;}
--></style></head>

@bschmalhofer bschmalhofer added bug Something isn't working as intended style Beautify please labels Jan 28, 2025
@bschmalhofer bschmalhofer added this to the OTOBO 11.0.8 milestone Jan 28, 2025
@bschmalhofer bschmalhofer self-assigned this Jan 28, 2025
bschmalhofer added a commit that referenced this issue Jan 28, 2025
try to improve the markup by marking commands and file names
bschmalhofer added a commit that referenced this issue Jan 28, 2025
try to improve the markup by marking commands and file names
@bschmalhofer
Copy link
Contributor Author

PR is merged. Let's wait a bit for whether there is any fallout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended style Beautify please
Projects
None yet
Development

No branches or pull requests

1 participant