jonkemp/gulp-inline-css

Changing `<img>` element closing?

sgarbesi opened this issue · 7 comments

This plugin converts this:

<img src="..." />

To This:

<img src="...">

This is invalid markup, and while I'm sure many of the new browsers/renderers will not have a problem with this, I fear that the legacy browsers/renderers (Microsoft Outlook cough) will.

This is valid in HTML5.

@jonkemp It's going to cause problems with the old renderers which I believe this plugin is geared towards? I'm sure in newer HTML renderers one can simply use a stylesheet via the link tag and not need to bother with inline styles. Defeats the purpose?

This module uses inline-css which uses cheerio, rather than juice which used jsdom. Apparently juice has an option to support closing tags now. Cheerio uses htmlparser2 which looks like it has an option to support this.

https://github.com/fb55/htmlparser2/wiki/Parser-options

I don't have plans to at this time though. I've had only a few requests for this. I would be interested in pull requests. Otherwise this could be something to look at doing at some point. I'll mark it as a feature request. Thanks.

@jonkemp If I change L164 in inline-css.js to .xml() it fixes it.

@jonkemp I submitted a PR.

well this was surprising