From 530bacb96044e7635be3b4968ee1192616d659d1 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 15 Aug 2023 18:40:32 +0200 Subject: chadombuilder: implement restart Now pages (once again) do not break when a meta charset tag is defined. Hooray! --- src/html/chadombuilder.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/html') diff --git a/src/html/chadombuilder.nim b/src/html/chadombuilder.nim index 13bad12c..f089b134 100644 --- a/src/html/chadombuilder.nim +++ b/src/html/chadombuilder.nim @@ -33,6 +33,17 @@ proc finish(builder: DOMBuilder[Node]) = script.execute() #TODO events +proc restart(builder: DOMBuilder[Node]) = + let document = newDocument() + document.contentType = "text/html" + let oldDocument = cast[Document](builder.document) + document.url = oldDocument.url + let window = oldDocument.window + if window != nil: + document.window = window + window.document = document + builder.document = document + proc parseError(builder: DOMBuilder[Node], message: string) = discard @@ -155,6 +166,7 @@ proc newChaDOMBuilder(url: URL, window: Window): ChaDOMBuilder = return ChaDOMBuilder( document: document, finish: finish, + restart: restart, setQuirksMode: setQuirksMode, setCharacterSet: setCharacterset, elementPopped: elementPopped, -- cgit 1.4.1-2-gfad0