diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/html/chadombuilder.nim | 10 | ||||
-rw-r--r-- | src/html/dom.nim | 3 | ||||
-rw-r--r-- | src/server/buffer.nim | 4 | ||||
-rw-r--r-- | src/version.nim | 4 |
4 files changed, 16 insertions, 5 deletions
diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim index 5ccc7ee2..23273747 100644 --- a/src/html/chadombuilder.nim +++ b/src/html/chadombuilder.nim @@ -120,7 +120,14 @@ proc insertText(builder: DOMBuilder[Node], parent: Node, text: string, discard parent.insertBefore(text, before) proc remove(builder: DOMBuilder[Node], child: Node) = - child.remove(true) + child.remove(suppressObservers = true) + +proc moveChildren(builder: DOMBuilder[Node], fromNode, toNode: Node) = + var tomove = fromNode.childList + for node in tomove: + node.remove(suppressObservers = true) + for child in tomove: + toNode.insert(child, nil) proc addAttrsIfMissing(builder: DOMBuilder[Node], element: Node, attrs: Table[string, string]) = @@ -183,6 +190,7 @@ proc newChaDOMBuilder(url: URL, window: Window): ChaDOMBuilder = insertBefore: insertBefore, insertText: insertText, remove: remove, + moveChildren: moveChildren, addAttrsIfMissing: addAttrsIfMissing, setScriptAlreadyStarted: setScriptAlreadyStarted, associateWithForm: associateWithForm, diff --git a/src/html/dom.nim b/src/html/dom.nim index 6f12f382..7843a424 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -36,6 +36,7 @@ import utils/twtstr import chakasu/charset import chakasu/decoderstream +import chakasu/encoderstream import chame/tags @@ -2634,7 +2635,7 @@ proc fetchClassicScript(element: HTMLScriptElement, url: URL, else: cs let decoder = newDecoderStream(response.body, cs = cs) - let source = decoder.readAll() + let source = newEncoderStream(decoder).readAll() let script = createClassicScript(source, url, options, false) element.markAsReady(ScriptResult(t: RESULT_SCRIPT, script: script)) diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 053483b5..6303fd65 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -52,6 +52,7 @@ import xhr/formdata as formdata_impl import chakasu/charset import chakasu/decoderstream +import chakasu/encoderstream import chame/tags @@ -605,7 +606,8 @@ proc loadResource(buffer: Buffer, elem: HTMLLinkElement): EmptyPromise = # utf8 anyways let ss = newStringStream(s.get) #TODO non-utf-8 css - let source = newDecoderStream(ss, cs = CHARSET_UTF_8).readAll() + let ds = newDecoderStream(ss, cs = CHARSET_UTF_8) + let source = newEncoderStream(ds, cs = CHARSET_UTF_8).readAll() let ss2 = newStringStream(source) elem.sheet = parseStylesheet(ss2)) diff --git a/src/version.nim b/src/version.nim index 2be08e9e..5e1976db 100644 --- a/src/version.nim +++ b/src/version.nim @@ -27,5 +27,5 @@ tryImport chakasu/version, "chakasu" tryImport chame/version, "chame" static: - checkVersion("chakasu", 0, 1, 2) - checkVersion("chame", 0, 9, 3) + checkVersion("chakasu", 0, 2, 0) + checkVersion("chame", 0, 10, 1) |