From 943f937622b08dc9b37c42f33b89985bd7c28c67 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 7 Mar 2023 19:53:06 +0100 Subject: [PATCH] refactor: change fkt name internalTemplateLookUP git s --- application/source/dom/updater.mjs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/application/source/dom/updater.mjs b/application/source/dom/updater.mjs index 8334d1e39..466bc2765 100644 --- a/application/source/dom/updater.mjs +++ b/application/source/dom/updater.mjs @@ -514,11 +514,19 @@ function insertElement(change) { } } -function findTemplate(container, key, ref, path) { - +/** + * @private + * @param container + * @param key + * @param ref + * @param path + * @returns {any} + */ +function internalTemplateLookUp(container, key, ref, path) { + let templateID = key; let template; - + if (container.hasAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID)) { templateID = container.getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID); template = findDocumentTemplate(templateID, container); @@ -526,7 +534,7 @@ function findTemplate(container, key, ref, path) { return template; } } - + if (container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`)) { templateID = container.closest(`[${ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID}]`).getAttribute(ATTRIBUTE_UPDATER_INSERT_TEMPLATE_ID); template = findDocumentTemplate(templateID, container); @@ -551,8 +559,8 @@ function findTemplate(container, key, ref, path) { */ function appendNewDocumentFragment(container, key, ref, path) { - let template = findTemplate(container, key, ref, path); -console.log(template); + let template = internalTemplateLookUp(container, key, ref, path); + let nodes = template.createDocumentFragment(); for (const [, node] of Object.entries(nodes.childNodes)) { if (node instanceof HTMLElement) { -- GitLab