about summary refs log tree commit diff stats
path: root/src/js/javascript.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-23 23:37:12 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-23 23:40:44 +0200
commit65fe1de341be4c6f8a7f1a0ec6d954be463bba29 (patch)
tree95cfd79c35d1ae3593dbe94f36acdd0c77b742ff /src/js/javascript.nim
parentc7b208ed8f99cdeaf93f7141197b549b32f88165 (diff)
downloadchawan-65fe1de341be4c6f8a7f1a0ec6d954be463bba29.tar.gz
DOMParser: use correct URL
Use current document's URL if window && window.document, otherwise
default to about:blank.

Also, it seems that passing nil to window is really necessary in some
cases, so remove notes indicating otherwise.
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r--src/js/javascript.nim7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index 345054dd..bedb18e5 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -239,11 +239,8 @@ func getClass*(ctx: JSContext, class: string): JSClassID =
   # This function *should* never fail.
   ctx.getOpaque().creg[class]
 
-func findClass*(ctx: JSContext, class: string): Option[JSClassID] =
-  let opaque = ctx.getOpaque()
-  if class in opaque.creg:
-    return some(opaque.creg[class])
-  return none(JSClassID)
+func hasClass*(ctx: JSContext, class: type): bool =
+  return $class in ctx.getOpaque().creg
 
 func newJSCFunction*(ctx: JSContext, name: string, fun: JSCFunction,
     argc: int = 0, proto = JS_CFUNC_generic, magic = 0): JSValue =