about summary refs log tree commit diff stats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-25 14:45:04 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-25 14:45:04 +0200
commit36b06265715bebbfaca831e517b547c87054e58c (patch)
tree526ae7867e8dbb295b93d52f57133a61ee846d79 /src/html
parentbd0d0f9185fabf887202a39f9dd823c6c511f839 (diff)
downloadchawan-36b06265715bebbfaca831e517b547c87054e58c.tar.gz
cssparser: remove SyntaxError
return DOMException instead
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 4d71c3a3..16335399 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -1581,10 +1581,13 @@ func formmethod*(element: Element): FormMethod =
   return FORM_METHOD_GET
 
 proc parseColor(element: Element, s: string): RGBAColor =
-  return cssColor(parseComponentValue(newStringStream(s)))
-    #TODO TODO TODO return element style
-    # For now we just use white.
-    .get(rgb(255, 255, 255))
+  let cval = parseComponentValue(newStringStream(s))
+  #TODO TODO TODO return element style
+  # For now we just use white.
+  let ec = rgb(255, 255, 255)
+  if cval.isErr:
+    return ec
+  return cssColor(cval.get).get(ec)
 
 #TODO ??
 func target0*(element: Element): string =