diff options
author | bptato <nincsnevem662@gmail.com> | 2021-11-23 13:29:47 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-11-23 13:29:47 +0100 |
commit | c183dd305c92304dec888cefdf1d1379415a8a86 (patch) | |
tree | 94c4393c9cb7b00d685477ac4daddccaa064f00c /src/html/parser.nim | |
parent | 30f3b5deb3be13683e73175f241600c028910eaa (diff) | |
download | chawan-c183dd305c92304dec888cefdf1d1379415a8a86.tar.gz |
Support CSS next- and subsequent sibling combinators
Diffstat (limited to 'src/html/parser.nim')
-rw-r--r-- | src/html/parser.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/html/parser.nim b/src/html/parser.nim index 3f1ca218..0102fe17 100644 --- a/src/html/parser.nim +++ b/src/html/parser.nim @@ -166,25 +166,25 @@ proc insertNode(parent: Node, node: Node) = parent.childNodes.add(node) if parent.childNodes.len > 1: - let prevSibling = parent.childNodes[^1] + let prevSibling = parent.childNodes[^2] prevSibling.nextSibling = node node.previousSibling = prevSibling node.parentNode = parent if parent.nodeType == ELEMENT_NODE: - node.parentElement = (Element)parent + node.parentElement = Element(parent) if parent.ownerDocument != nil: node.ownerDocument = parent.ownerDocument elif parent.nodeType == DOCUMENT_NODE: - node.ownerDocument = (Document)parent + node.ownerDocument = Document(parent) if node.nodeType == ELEMENT_NODE: - parent.children.add((Element)node) + parent.children.add(Element(node)) - let element = ((Element)node) + let element = (Element(node)) if element.ownerDocument != nil: - node.ownerDocument.all_elements.add((Element)node) + node.ownerDocument.all_elements.add(Element(node)) element.ownerDocument.type_elements[element.tagType].add(element) if element.id != "": if not (element.id in element.ownerDocument.id_elements): |