aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2022-08-31 21:20:01 +0100
committerMichael Williamson <mike@zwobble.org>2022-08-31 21:20:01 +0100
commit62ccce26f2b44ecd5df06670d0e935d7d57d7d4d (patch)
tree280c8ab542e06a441374f147d84bcd93ff41bec1 /lib
parentd67ddaff3c05da19012a1daff584a0f33ff5df83 (diff)
Only use the alt text of image elements as a fallback
Diffstat (limited to 'lib')
-rw-r--r--lib/images.js4
1 files changed, 3 insertions, 1 deletions
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)];
});
};