From b164be1660fb19dae8c229d262f2837aacc97864 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Mon, 20 Mar 2023 09:46:28 +0100
Subject: [PATCH] fix: check is attribute set

---
 application/source/dom/updater.mjs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/application/source/dom/updater.mjs b/application/source/dom/updater.mjs
index 875ae02af..a92590fab 100644
--- a/application/source/dom/updater.mjs
+++ b/application/source/dom/updater.mjs
@@ -291,6 +291,7 @@ function retrieveAndSetValue(element) {
     const pathfinder = new Pathfinder(self[internalSymbol].subject.getSubject());
 
     let path = element.getAttribute(ATTRIBUTE_UPDATER_BIND);
+    if (path === null) throw new Error("the bind argument must start as a value with a path");
 
     if (path.indexOf("path:") !== 0) {
         throw new Error("the bind argument must start as a value with a path");
@@ -434,6 +435,8 @@ function insertElement(change) {
                 found = true;
 
                 const attributes = containerElement.getAttribute(ATTRIBUTE_UPDATER_INSERT);
+                if (attributes === null) continue;
+                
                 let def = trimSpaces(attributes);
                 let i = def.indexOf(" ");
                 let key = trimSpaces(def.substr(0, i));
@@ -489,6 +492,7 @@ function insertElement(change) {
                 let nodes = containerElement.querySelectorAll(
                     `[${ATTRIBUTE_UPDATER_INSERT_REFERENCE}*="${refPrefix}"]`,
                 );
+                
                 for (const [, node] of Object.entries(nodes)) {
                     if (!available.has(node.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE))) {
                         try {
@@ -716,10 +720,10 @@ function runUpdateAttributes(container, parts, subject) {
             mem.add(element);
 
             // this case occurs when the ATTRIBUTE_UPDATER_SELECT_THIS attribute is set 
-            if(!element.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)) {
+            if (!element.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)) {
                 continue;
             }
-            
+
             const attributes = element.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);
 
             for (let [, def] of Object.entries(attributes.split(","))) {
-- 
GitLab