Move away from Object.assign for image rendering.
This commit is contained in:
parent
da48ddec83
commit
c620e9c930
1 changed files with 5 additions and 7 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue