From dce536e58023b13eb2efc17e4ffb538632933b23 Mon Sep 17 00:00:00 2001 From: leobm Date: Wed, 23 Nov 2022 00:54:18 +0100 Subject: [PATCH] fix, ssc createNode operatin bug, when target node (by path) is a text node --- lib/IHP/static/vendor/ihp-ssc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/IHP/static/vendor/ihp-ssc.js b/lib/IHP/static/vendor/ihp-ssc.js index 07c18bc72..f73a30c6e 100644 --- a/lib/IHP/static/vendor/ihp-ssc.js +++ b/lib/IHP/static/vendor/ihp-ssc.js @@ -75,7 +75,12 @@ function evaluateNodeOperation(component, nodeOperation) { function createNode(component, nodeOperation) { var newElement = htmlStringToDomNode(nodeOperation.html); - nodeOperation.domNode.appendChild(newElement); + var domNode = nodeOperation.domNode; + if (domNode.nodeType == Node.TEXT_NODE) { + domNode.replaceWith(newElement); + } else { + domNode.appendChild(newElement); + } } function updateTextContent(component, nodeOperation) {