melody icon indicating copy to clipboard operation
melody copied to clipboard

The attrs filter doesn't add a valid empty alt attribute

Open iandevlin opened this issue 7 years ago • 2 comments

Explain the problem

If an img has an empty alt passed through the attrs filter, it does not get added because the filter doesn't add attributes with empty values.

Expected Behaviour

The alt attribute should be added with an empty string as its value.

Actual Behaviour

The alt attribute does not get added.

I think the attrs filter needs to add a special case so that it adds the alt attribute even if the provided value is an empty string (which is valid and often desired).

iandevlin avatar Apr 06 '18 14:04 iandevlin

Does <img alt="" src="..."> work?

pago avatar Apr 25 '18 05:04 pago

Yes, simply adding an empty alt outside of attrs works just fine of course so it is a workaround, but attrs should really support it as it is a valid value for alt.

iandevlin avatar Apr 25 '18 17:04 iandevlin