juice icon indicating copy to clipboard operation
juice copied to clipboard

Juice converts with empty string to empty attributes

Open bures opened this issue 6 years ago • 5 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="">

bures avatar Apr 24 '19 07:04 bures

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.

jrit avatar Apr 24 '19 16:04 jrit

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

bures avatar Apr 24 '19 16:04 bures

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

bures avatar Apr 24 '19 17:04 bures

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

howeller avatar Oct 21 '21 17:10 howeller

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>

husseinalhammad avatar Sep 05 '22 10:09 husseinalhammad