« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/util/html.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/html.js b/src/util/html.js
index 2468b8d..b49cce0 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -193,7 +193,11 @@ export class Tag {
   }
 
   clone() {
-    return new Tag(this.tagName, this.attributes, this.content);
+    return Reflect.construct(this.constructor, [
+      this.tagName,
+      this.attributes,
+      this.content,
+    ]);
   }
 
   set tagName(value) {
@@ -507,8 +511,12 @@ export class Template {
   }
 
   clone() {
-    const clone = new Template(this.#description);
+    const clone = Reflect.construct(this.constructor, [
+      this.#description,
+    ]);
+
     clone.setSlots(this.#slotValues);
+
     return clone;
   }