gulp-inline-css icon indicating copy to clipboard operation
gulp-inline-css copied to clipboard

Changing `<img>` element closing?

Open sgarbesi opened this issue 8 years ago • 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.

sgarbesi avatar Nov 23 '15 06:11 sgarbesi

This is valid in HTML5.

jonkemp avatar Nov 23 '15 14:11 jonkemp

@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?

sgarbesi avatar Nov 23 '15 17:11 sgarbesi

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 avatar Nov 23 '15 18:11 jonkemp

https://github.com/cheeriojs/cheerio/issues/378

sgarbesi avatar Nov 23 '15 19:11 sgarbesi

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

sgarbesi avatar Nov 23 '15 19:11 sgarbesi

@jonkemp I submitted a PR.

sgarbesi avatar Nov 23 '15 19:11 sgarbesi

well this was surprising

drKnoxy avatar Mar 24 '16 20:03 drKnoxy