From 62ccce26f2b44ecd5df06670d0e935d7d57d7d4d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 31 Aug 2022 21:20:01 +0100 Subject: Only use the alt text of image elements as a fallback --- lib/images.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/images.js b/lib/images.js index c7d3ef5..fc45115 100644 --- a/lib/images.js +++ b/lib/images.js @@ -8,10 +8,12 @@ exports.imgElement = imgElement; function imgElement(func) { return function(element, messages) { return promises.when(func(element)).then(function(result) { - var attributes = _.clone(result); + var attributes = {}; if (element.altText) { attributes.alt = element.altText; } + _.extend(attributes, result); + return [Html.freshElement("img", attributes)]; }); }; -- cgit v1.2.3