Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raw_html treats the content of title tags as plain text #555

Merged
merged 2 commits into from
Mar 23, 2024
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/raw_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ defmodule Floki.RawHTML do
case type do
"script" -> @no_encoder
"style" -> @no_encoder
"title" -> @no_encoder
_ -> encoder
end

Expand Down
6 changes: 6 additions & 0 deletions test/floki_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@ defmodule FlokiTest do
assert recombined
end

test "raw_html treats the contents of title tags as plain text" do
html_string = ~s(<html><head><title> <b> bold </b> text </title></head><body></body></html>)
parsed = Floki.parse_document!(html_string)
assert ^html_string = Floki.raw_html(parsed)
end

# Floki.find/2 - Classes

test "find elements with a given class" do
Expand Down
Loading