PreMailer.Net icon indicating copy to clipboard operation
PreMailer.Net copied to clipboard

PreMailer removes closing tags from IMG

Open GSDUser opened this issue 6 years ago • 1 comments

Hi, When running some tests I found that PreMailer removes the closing '/' from an IMG tag. This causes XHTML validation to fail on the resulting Html.

e.g.

<html>
    <head>
          <style> img { padding-bottom: 5px; } </style>
    </head>
...
<img src="myPic.png"/>

after parsing, the img tag becomes

<img src="myPic.png" style="padding-bottom: 5px;"> (The closing / is removed by PreMailer)

UPDATE: It appears that the closing slash is removed from all self closing tags (img, br, col, input etc) - This causes a problem when the output html is required to be XHTML compliant.

Thanks

Gary

GSDUser avatar Oct 26 '18 16:10 GSDUser

PreMailer makes use of AngleSharp. This answer on SO from Florian Rappl - the author of AngleSharp - gives an answer why things are like you described. This one may help as well.

axunonb avatar Dec 30 '18 16:12 axunonb