about summary refs log tree commit diff stats
path: root/src/html/chadombuilder.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-14 03:18:52 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-14 03:47:39 +0200
commit1c494d3fd5fb746d5a5b6d582119cda261e1e7b5 (patch)
treef8d79b5d5f48163c2baea7455192a0e4580eca6b /src/html/chadombuilder.nim
parent7ebc5fb31478e9568b95359562776adc7d072d82 (diff)
downloadchawan-1c494d3fd5fb746d5a5b6d582119cda261e1e7b5.tar.gz
Update submodules
Diffstat (limited to 'src/html/chadombuilder.nim')
-rw-r--r--src/html/chadombuilder.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim
index 5ccc7ee2..23273747 100644
--- a/src/html/chadombuilder.nim
+++ b/src/html/chadombuilder.nim
@@ -120,7 +120,14 @@ proc insertText(builder: DOMBuilder[Node], parent: Node, text: string,
     discard parent.insertBefore(text, before)
 
 proc remove(builder: DOMBuilder[Node], child: Node) =
-  child.remove(true)
+  child.remove(suppressObservers = true)
+
+proc moveChildren(builder: DOMBuilder[Node], fromNode, toNode: Node) =
+  var tomove = fromNode.childList
+  for node in tomove:
+    node.remove(suppressObservers = true)
+  for child in tomove:
+    toNode.insert(child, nil)
 
 proc addAttrsIfMissing(builder: DOMBuilder[Node], element: Node,
     attrs: Table[string, string]) =
@@ -183,6 +190,7 @@ proc newChaDOMBuilder(url: URL, window: Window): ChaDOMBuilder =
     insertBefore: insertBefore,
     insertText: insertText,
     remove: remove,
+    moveChildren: moveChildren,
     addAttrsIfMissing: addAttrsIfMissing,
     setScriptAlreadyStarted: setScriptAlreadyStarted,
     associateWithForm: associateWithForm,