diff options
author | bptato <nincsnevem662@gmail.com> | 2023-08-29 22:53:25 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-08-29 22:53:25 +0200 |
commit | e44e5c93f698f5ddf3168cfcc87a4494ad91641d (patch) | |
tree | e00f31b3808733fbb3e2c016c56c1ce412db58f2 /src/html | |
parent | a0af8402e3cceea30ec571660faa7fb1032e7527 (diff) | |
download | chawan-e44e5c93f698f5ddf3168cfcc87a4494ad91641d.tar.gz |
javascript: factor out fromJS
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/chadombuilder.nim | 1 | ||||
-rw-r--r-- | src/html/dom.nim | 3 | ||||
-rw-r--r-- | src/html/event.nim | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim index ad8f7f36..5ccc7ee2 100644 --- a/src/html/chadombuilder.nim +++ b/src/html/chadombuilder.nim @@ -4,6 +4,7 @@ import streams import html/dom import js/error +import js/fromjs import js/javascript import types/url diff --git a/src/html/dom.nim b/src/html/dom.nim index c0b60728..617ec404 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -20,6 +20,7 @@ import io/request import io/window import js/domexception import js/error +import js/fromjs import js/javascript import js/opaque import js/timeout @@ -2943,7 +2944,7 @@ proc jsReflectSet(ctx: JSContext, this, val: JSValue, magic: cint): JSValue {.cd return JS_ThrowTypeError(ctx, "Invalid tag type %s", element.tagType) case entry.t of REFLECT_STR: - let x = toString(ctx, val) + let x = fromJS[string](ctx, val) if x.isSome: element.attr(entry.attrname, x.get) of REFLECT_BOOL: diff --git a/src/html/event.nim b/src/html/event.nim index 0584b230..5f841fd1 100644 --- a/src/html/event.nim +++ b/src/html/event.nim @@ -3,6 +3,7 @@ import times import bindings/quickjs import js/error +import js/fromjs import js/javascript import js/tojs import utils/opt |