about summary refs log tree commit diff stats
path: root/src/html/chadombuilder.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/chadombuilder.nim')
-rw-r--r--src/html/chadombuilder.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim
index 5c7b1770..acddb287 100644
--- a/src/html/chadombuilder.nim
+++ b/src/html/chadombuilder.nim
@@ -50,6 +50,9 @@ proc getTemplateContent(builder: DOMBuilder[Node], handle: Node): Node =
 proc getTagType(builder: DOMBuilder[Node], handle: Node): TagType =
   return Element(handle).tagType
 
+proc getParentNode(builder: DOMBuilder[Node], handle: Node): Node =
+  return handle.parentNode
+
 proc getLocalName(builder: DOMBuilder[Node], handle: Node): string =
   return Element(handle).localName
 
@@ -100,9 +103,8 @@ proc insertText(builder: DOMBuilder[Node], parent: Node, text: string,
     let text = builder.getDocument().createTextNode(text)
     discard parent.insertBefore(text, before)
 
-proc reparent(builder: DOMBuilder[Node], child, newParent: Node) =
+proc remove(builder: DOMBuilder[Node], child: Node) =
   child.remove(true)
-  newParent.append(child)
 
 proc addAttrsIfMissing(builder: DOMBuilder[Node], element: Node,
     attrs: Table[string, string]) =
@@ -155,6 +157,7 @@ proc newChaDOMBuilder(url: URL, window: Window): ChaDOMBuilder =
     elementPopped: elementPopped,
     getTemplateContent: getTemplateContent,
     getTagType: getTagType,
+    getParentNode: getParentNode,
     getLocalName: getLocalName,
     getNamespace: getNamespace,
     createElement: createElement,
@@ -162,7 +165,7 @@ proc newChaDOMBuilder(url: URL, window: Window): ChaDOMBuilder =
     createDocumentType: createDocumentType,
     insertBefore: insertBefore,
     insertText: insertText,
-    reparent: reparent,
+    remove: remove,
     addAttrsIfMissing: addAttrsIfMissing,
     setScriptAlreadyStarted: setScriptAlreadyStarted,
     associateWithForm: associateWithForm,