diff --git a/application/source/dom/updater.mjs b/application/source/dom/updater.mjs index 8334d1e39ec0d65d370e58aade3d9a0266dc1f90..466bc2765e2446b9599eac864ad614946139d186 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) {