From 1fffa91d427d122a53ec329801a4ca8a92a94a4f Mon Sep 17 00:00:00 2001 From: Matthias Leuffen Date: Fri, 13 Oct 2023 14:53:35 +0200 Subject: [PATCH] remove 'null' message from empty slots --- package.json | 2 +- src/helper/functions.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 522b83e..abd3b77 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@leuffen/jodastyle", - "version": "3.0.4", + "version": "3.0.5", "description": "", "main": "./dist/index.js", "module": "./dist/index.module.js", diff --git a/src/helper/functions.ts b/src/helper/functions.ts index 3889a29..6c8e7f2 100755 --- a/src/helper/functions.ts +++ b/src/helper/functions.ts @@ -219,7 +219,12 @@ export async function getTemplateFilledWithContent(templateSelector : string, co let selected: any; if (slot.getAttribute("data-limit") === "1") { - selected = Array.from([content.querySelector(select)]); + let curElements = content.querySelector(select); + if (curElements === null) { + selected = []; + } else { + selected = Array.from([content.querySelector(select)]); + } } else { selected = Array.from(content.querySelectorAll(select)); }