about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-03 22:18:08 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-03 22:18:38 +0100
commit8fb8f3547e122359d0315884c1ff46476f6e4ef3 (patch)
tree93d640a2aacac88b66fee5b9c865e50727bb461f /src
parentcaa0763b6f874ed983bdaf4ff4318ce33a613cb1 (diff)
downloadchawan-8fb8f3547e122359d0315884c1ff46476f6e4ef3.tar.gz
dom: make stringifiers explicit, optimize tokenList toString
Diffstat (limited to 'src')
-rw-r--r--src/html/dom.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 26ffc2c9..105e1937 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -1476,13 +1476,13 @@ func jsContains(tokenList: DOMTokenList; s: string): bool
     {.jsfunc: "contains".} =
   return tokenList.element.document.toAtom(s) in tokenList
 
-func `$`(tokenList: DOMTokenList): string {.jsfunc.} =
+func `$`(tokenList: DOMTokenList): string {.jsfunc: "toString".} =
   var s = ""
   for i, tok in tokenList.toks:
     if i != 0:
       s &= ' '
     s &= tokenList.element.document.toStr(tok)
-  return s
+  return move(s)
 
 proc update(tokenList: DOMTokenList) =
   if not tokenList.element.attrb(tokenList.localName) and
@@ -1804,7 +1804,7 @@ proc setLocation*(document: Document; s: string): Err[JSError]
 
 # Note: we do not implement security checks (as documents are in separate
 # windows anyway).
-proc `$`(location: Location): string {.jsuffunc.} =
+proc `$`(location: Location): string {.jsuffunc: "toString".} =
   return location.url.serialize()
 
 proc href(location: Location): string {.jsuffget.} =