Floki.attr
You're seeing just the function
attr
, go back to Floki module for more information.
Specs
attr( binary() | html_tree() | html_node(), css_selector(), binary(), (binary() -> binary()) ) :: html_tree()
Changes the attribute values of the elements matched by selector
with the function mutation
and returns the whole element tree.
Examples
iex> Floki.attr([{"div", [{"id", "a"}], []}], "#a", "id", fn(id) -> String.replace(id, "a", "b") end)
[{"div", [{"id", "b"}], []}]
iex> Floki.attr([{"div", [{"class", "name"}], []}], "div", "id", fn _ -> "b" end)
[{"div", [{"id", "b"}, {"class", "name"}], []}]