File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ defmodule Phoenix.HTML.Engine do
1616 """
1717 def encode_to_iodata! ( { :safe , body } ) , do: body
1818 def encode_to_iodata! ( nil ) , do: ""
19+ def encode_to_iodata! ( "" ) , do: ""
1920 def encode_to_iodata! ( bin ) when is_binary ( bin ) , do: html_escape ( bin )
2021 def encode_to_iodata! ( list ) when is_list ( list ) , do: Phoenix.HTML.Safe.List . to_iodata ( list )
2122 def encode_to_iodata! ( other ) , do: Phoenix.HTML.Safe . to_iodata ( other )
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ defmodule Phoenix.HTMLTest do
3636 html_escape ( ~c" foo🐥" )
3737 end
3838 end
39+
40+ test "equivalences" do
41+ # Since some HTML code may compare html_escape("") with html_escape(nil),
42+ # we make sure they have equivalent representations.
43+ assert html_escape ( "" ) == html_escape ( nil )
44+ end
3945 end
4046
4147 describe "attributes_escape" do
You can’t perform that action at this time.
0 commit comments