msva / lua-htmlparser

An HTML parser for lua.
231 stars 44 forks source link

Selector results should be ordered. #25

Closed hugomg closed 10 years ago

hugomg commented 10 years ago

The select method returns an unordered Set and there is no way to reorder the returned nodes according to the order they appeared in the original document. This makes it harder to write programs that expect a particular order, like something that prints the <li> nodes in a <ol> or a program that reads data from the columns in a table row.

Maybe this isn't feasible for backwards compatibility reasons but, given the similarities to JQuery or BeautifulSoup I would expect select to return a list or ordered set. After that, if I wanted the old behaviour with sets it would just be a matter of creating the set explicitly with Set(element_list).

wscherphof commented 10 years ago

Thanks. Makes sense. Seems feasible.

wscherphof commented 10 years ago

Since #24 is now solved, plan to get to #25 next..