Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/floki/deep_text.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ defmodule Floki.DeepText do

defp get_text({"script", _, _}, acc, _, _, false, _), do: acc
defp get_text({"style", _, _}, acc, _, _, _, false), do: acc
defp get_text({:pi, _, _}, acc, _, _, _, _), do: acc

defp get_text({"input", attrs, _}, acc, _, true, _, _) do
[acc, Floki.TextExtractor.extract_input_value(attrs)]
Expand Down
6 changes: 6 additions & 0 deletions test/floki/deep_text_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,10 @@ defmodule Floki.DeepTextTest do

assert Floki.DeepText.get(nodes) == "foo\nbaz"
end

test "HTML that contains a processing instruction (<?xml ... ?>)" do
nodes = [{:pi, "", [{"indica", "indica"}]}, "foo"]

assert Floki.DeepText.get(nodes) == "foo"
end
end
6 changes: 6 additions & 0 deletions test/floki/flat_text_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,10 @@ defmodule Floki.FlatTextTest do
assert Floki.FlatText.get([]) == ""
assert Floki.FlatText.get({"div", [], []}) == ""
end

test "HTML that contains a processing instruction (<?xml ... ?>)" do
nodes = [{:pi, "", [{"indica", "indica"}]}, "foo"]

assert Floki.FlatText.get(nodes) == "foo"
end
end
Loading