Automattic / juice

Juice inlines CSS stylesheets into your HTML source.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Juice converts with empty string to empty attributes

bures opened this issue · comments

When processing the snippet below:
<img src="XX" alt="">
Juice outputs
<img src="XX" alt>

How to make it output the following?
<img src="XX" alt="">

It seems that the web version http://automattic.github.io/juice/ works just fine - it outputs
<img src="XX" alt="">

This is happening in one of the deps. Semantically, those two are the same so I'd accept a PR that might fix it, but it isn't something I'll be spending time on.

Do you know which dependency causes that? I can check it then if there is any easy fix.

Would it be possible to send me which dependencies (versions) are used on automattic.github.io/juice ? Thanks.

Did anyone find the dependency at the root of this? I would love to see it fixed.

I think this is caused by Cheerio.

This can be reproduced:
https://runkit.com/embed/0rsw43pfqtqi

const cheerio = require('cheerio');
const $ = cheerio.load('<img alt="">');
$.html();

Result:

<img alt>