diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-26 19:42:19 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-26 19:42:19 +0100 |
commit | 774aad55da0fc62f8de8c95dbbb3d2ad41010e3f (patch) | |
tree | c80f7a6d783261b5fe741749aa5f8a52abcc7919 /src/html/htmlparser.nim | |
parent | 636ddbb788a4a4dcd4dc4bc247159b6bb191ef8a (diff) | |
download | chawan-774aad55da0fc62f8de8c95dbbb3d2ad41010e3f.tar.gz |
dom: correct constructors, more create functions
Diffstat (limited to 'src/html/htmlparser.nim')
-rw-r--r-- | src/html/htmlparser.nim | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/html/htmlparser.nim b/src/html/htmlparser.nim index f306d5f4..310a11aa 100644 --- a/src/html/htmlparser.nim +++ b/src/html/htmlparser.nim @@ -327,7 +327,7 @@ template insert_character_impl(parser: var HTML5Parser, data: typed) = if insertNode != nil and insertNode.nodeType == TEXT_NODE: dom.Text(insertNode).data &= data else: - let text = location.inside.document.newText($data) + let text = location.inside.document.createTextNode($data) location.insert(text) if location.inside.nodeType == ELEMENT_NODE: @@ -346,11 +346,11 @@ proc insertCharacter(parser: var HTML5Parser, data: Rune) = insert_character_impl(parser, data) proc insertComment(parser: var HTML5Parser, token: Token, position: AdjustedInsertionLocation) = - position.insert(position.inside.document.newComment(token.data)) + position.insert(position.inside.document.createComment(token.data)) proc insertComment(parser: var HTML5Parser, token: Token) = let position = parser.appropriatePlaceForInsert() - position.insert(position.inside.document.newComment(token.data)) + position.insert(position.inside.document.createComment(token.data)) const PublicIdentifierEquals = [ "-//W3O//DTD W3 HTML Strict 3.0//EN//", @@ -2212,6 +2212,7 @@ proc parseHTML*(inputStream: Stream, cs = none(Charset), fallbackcs = CHARSET_UT for c in bom: decoder.prepend(cast[uint32](c)) parser.document = newDocument() + parser.document.contentType = "text/html" if window != nil: parser.document.window = window window.document = parser.document |