GULPF / nimquery

Nim library for querying HTML using CSS-selectors (like JavaScripts document.querySelector)
MIT License
134 stars 8 forks source link

wrong order of results #13

Closed veksha closed 2 years ago

veksha commented 3 years ago
let html = """
<td class="some">
    <a href="">
        <span><b>text1</b></span>
        <b>text2</b>
    </a>
</td>
"""
import xmltree, htmlparser, streams, nimquery
let xml = parseHtml(newStringStream(html))
echo xml.querySelectorAll("b")

output: @[<b>text2</b>, <b>text1</b>] expected: @[<b>text1</b>, <b>text2</b>]

BTW: what is the difference between using newStringStream and not using it for parseHtml? i found that some htmls not parsed correctly if you omit newStringStream.

Niminem commented 2 years ago

Is an update being worked on for this? I'd really like to use this lib for a parsing engine