foundation-emails icon indicating copy to clipboard operation
foundation-emails copied to clipboard

Elements are not self-closing

Open Stadly opened this issue 9 years ago • 3 comments

How can we reproduce this bug? Use a self-closing element in your email, such as <hr />. Note that the default layout contains such elements in form of link and meta in the head element. Compile the email.

What did you expect to happen? The self-closing element should end with />, since the doctype is xhtml.

What happened instead? The self-closing elements are not closed according to the xhtml specification. Both <hr>, <hr/> and <hr /> end up as <hr> after compilation.

Stadly avatar Sep 14 '16 11:09 Stadly

This seems to be an issue with cheerio.

Also see https://github.com/cheeriojs/cheerio/issues/1235 Enabling the xmlMode sould probably resolve this: https://repl.it/repls/SpectacularBigElements

DanielRuf avatar Dec 19 '19 07:12 DanielRuf

Seems the xmlMode breaks things more than it fixes. This is very problematic.

https://repl.it/repls/WanScratchyResearch

In general the email clients should not have an issue with the markup as they all show the content without any issues.

DanielRuf avatar Dec 19 '19 08:12 DanielRuf

See https://repl.it/@DanielRuf/QuickJuniorListener for a solution using jsdom.

Relevant: https://github.com/jsdom/jsdom/issues/798#issuecomment-434066640 https://github.com/jsdom/jsdom/issues/1839#issuecomment-299461722

DanielRuf avatar Dec 19 '19 08:12 DanielRuf