diff --git a/lib/floki/raw_html.ex b/lib/floki/raw_html.ex index 41e72b9c..108812ce 100644 --- a/lib/floki/raw_html.ex +++ b/lib/floki/raw_html.ex @@ -178,6 +178,7 @@ defmodule Floki.RawHTML do case type do "script" -> @no_encoder "style" -> @no_encoder + "title" -> @no_encoder _ -> encoder end diff --git a/test/floki_test.exs b/test/floki_test.exs index a4fce9db..5d21ef90 100644 --- a/test/floki_test.exs +++ b/test/floki_test.exs @@ -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( <b> bold </b> text ) + 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