From 441917b7a9e8ccfc336c3508ef188bcb79a42d9f Mon Sep 17 00:00:00 2001 From: klarstrup Date: Mon, 24 Apr 2023 14:39:10 +0200 Subject: [PATCH] fix(Incito): Load lazy element backgrounds (#195) Fixes #194 --- lib/incito-browser/incito.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/incito-browser/incito.ts b/lib/incito-browser/incito.ts index 31540822..64f50923 100644 --- a/lib/incito-browser/incito.ts +++ b/lib/incito-browser/incito.ts @@ -854,11 +854,12 @@ export default class Incito extends MicroEvent<{ .catch(() => { el.innerHTML = this.renderHtml({}); }); - } else if (el.dataset.bg) { - el.style.backgroundImage = `url(${el.dataset.bg})`; } else if (el.dataset.src) { el.src = el.dataset.src; } + if (el.dataset.bg) { + el.style.backgroundImage = `url(${el.dataset.bg})`; + } } triggerSectionVisibility(sectionEl: HTMLElement, visible: boolean) {