GULPF / nimquery

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

Selector with space inverse elements #1

Closed grazil closed 6 years ago

grazil commented 6 years ago

Hello,

When using the usage example, and replacing the query by body p, the list of paragraph are in the reverse order: @[<p>4</p>, <p>3</p>, <p>2</p>, <p>1</p>]

Thanks for your work !

vindarel commented 6 years ago

yes, thanks for your work ! Quick question (or feature request ?), how can we get the text of an element ? Maybe with xmltree.text ? I tried

let xml = parseHtml(newStringStream(html))
let elements = xml.querySelectorAll("tbody tr .Title a")
for i in 0..3:
    echo elements[i].text # does not work
grazil commented 6 years ago

You can user the innerText property.

You will find all the informations for this lib in this doc: https://nim-lang.org/docs/xmltree.html