Move away from Object.assign for image rendering.

This commit is contained in:
Danila Fedorin 2021-07-16 13:51:34 -07:00
parent da48ddec83
commit c620e9c930

View file

@ -50,13 +50,11 @@ function renderList(listBlock) {
} }
function renderImage(imagePart) { function renderImage(imagePart) {
const attributes = Object.assign( const attributes = { src: imagePart.src };
{ src: imagePart.src }, if (imagePart.width) { attributes.width = imagePart.width }
imagePart.width && { width: imagePart.width }, if (imagePart.height) { attributes.height = imagePart.height }
imagePart.height && { height: imagePart.height }, if (imagePart.alt) { attributes.alt = imagePart.alt }
imagePart.alt && { alt: imagePart.alt }, if (imagePart.title) { attributes.title = imagePart.title }
imagePart.title && { title: imagePart.title }
);
return tag.img(attributes); return tag.img(attributes);
} }