philss / floki

Floki is a simple HTML parser that enables search for nodes using CSS selectors.
https://hex.pm/packages/floki
MIT License
2.07k stars 156 forks source link

Can't select sibling options #39

Closed sntran closed 9 years ago

sntran commented 9 years ago

Test case:

iex> html = "<select><option value=\"foo\">Foo</option><option value=\"bar\">Bar</option><option value=\"barz\">Barz</option></select>"
iex> Floki.parse(html) |> Floki.find("select option + option")
** (ArgumentError) argument error
    :erlang.hd([])
    lib/floki/finder.ex:90: Floki.Finder.traverse_sibling/4
    lib/floki/finder.ex:60: Floki.Finder.traverse/4
    lib/floki/finder.ex:40: Floki.Finder.traverse/4
    lib/floki/finder.ex:56: Floki.Finder.traverse/4
    lib/floki/finder.ex:44: Floki.Finder.traverse/4
    lib/floki/finder.ex:23: Floki.Finder.find/2

Floki version: 0.6.1

philss commented 9 years ago

Hi @sntran! Thank you for the report!

It is fixed in the version 0.7.0. Please check that.

sntran commented 9 years ago

:clap: Thank you!