diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index b43d99ebb7..c1015ffe89 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -765,7 +765,7 @@ module ActionView # # => # # label(:post, :terms) do - # 'Accept Terms.'.html_safe + # raw('Accept Terms.') # end # # => def label(object_name, method, content_or_options = nil, options = nil, &block) @@ -1675,7 +1675,7 @@ module ActionView # # => # # label(:terms) do - # 'Accept Terms.'.html_safe + # raw('Accept Terms.') # end # # => def label(method, text = nil, options = {}, &block) diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index d521553481..55dac74d00 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -93,22 +93,22 @@ module ActionView # select_tag "people", options_from_collection_for_select(@people, "id", "name", "1") # # # - # select_tag "people", "".html_safe + # select_tag "people", raw("") # # => # - # select_tag "count", "".html_safe + # select_tag "count", raw("") # # => # - # select_tag "colors", "".html_safe, multiple: true + # select_tag "colors", raw(""), multiple: true # # => # - # select_tag "locations", "".html_safe + # select_tag "locations", raw("") # # => # - # select_tag "access", "".html_safe, multiple: true, class: 'form_input', id: 'unique_id' + # select_tag "access", raw(""), multiple: true, class: 'form_input', id: 'unique_id' # # => # @@ -121,7 +121,7 @@ module ActionView # select_tag "people", options_from_collection_for_select(@people, "id", "name"), prompt: "Select something" # # => # - # select_tag "destination", "".html_safe, disabled: true + # select_tag "destination", raw(""), disabled: true # # => # diff --git a/actionview/lib/action_view/helpers/output_safety_helper.rb b/actionview/lib/action_view/helpers/output_safety_helper.rb index 1c2a400245..c0fc3b820f 100644 --- a/actionview/lib/action_view/helpers/output_safety_helper.rb +++ b/actionview/lib/action_view/helpers/output_safety_helper.rb @@ -22,10 +22,10 @@ module ActionView #:nodoc: # the supplied separator, are HTML escaped unless they are HTML # safe, and the returned string is marked as HTML safe. # - # safe_join(["
foo
".html_safe, "bar
"], "foo
"), "bar
"], "foo
<br /><p>bar</p>" # - # safe_join(["foo
".html_safe, "bar
".html_safe], "foo
"), raw("bar
")], raw("foo
bar
" # def safe_join(array, sep=$,) diff --git a/actionview/test/template/active_model_helper_test.rb b/actionview/test/template/active_model_helper_test.rb index 86bccdfade..55d62cf692 100644 --- a/actionview/test/template/active_model_helper_test.rb +++ b/actionview/test/template/active_model_helper_test.rb @@ -85,7 +85,7 @@ class ActiveModelHelperTest < ActionView::TestCase def test_field_error_proc old_proc = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| - %(title
".html_safe + provide :title, raw("title
") assert_equal "hititle
", content_for(:title) end diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index 92e77599f4..4678998bdc 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -3207,7 +3207,7 @@ class DateHelperTest < ActionView::TestCase end def test_time_tag_with_given_block - assert_match(/foo
".html_safe, "bar
"], "foo
"), "bar
"], "foo
<br /><p>bar</p>", joined - joined = safe_join(["foo
".html_safe, "bar
".html_safe], "foo
"), raw("bar
")], raw("foo
bar
", joined end diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index d037447567..6f7a78ccef 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -143,10 +143,10 @@ class TagHelperTest < ActionView::TestCase end def test_tag_honors_html_safe_with_escaped_array_class - str = tag('p', :class => ['song>', 'play>'.html_safe]) + str = tag('p', :class => ['song>', raw('play>')]) assert_equal '', str - str = tag('p', :class => ['song>'.html_safe, 'play>']) + str = tag('p', :class => [raw('song>'), 'play>']) assert_equal '', str end diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 89cabb8f6b..3010656166 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -78,7 +78,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_button_to_with_path assert_dom_equal( %{}, - button_to("Hello", article_path("Hello".html_safe)) + button_to("Hello", article_path("Hello")) ) end @@ -106,7 +106,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_html_safe_URL - assert_dom_equal %{}, button_to("Hello", "http://www.example.com/q1=v1&q2=v2".html_safe) + assert_dom_equal %{}, button_to("Hello", raw("http://www.example.com/q1=v1&q2=v2")) end def test_button_to_with_query_and_no_name @@ -232,7 +232,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_link_tag_with_img - link = link_to("".html_safe, "/") + link = link_to(raw(""), "/") expected = %{} assert_dom_equal expected, link end @@ -358,7 +358,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_link_tag_with_html_safe_string assert_dom_equal( %{Gerd Müller}, - link_to("Gerd Müller", article_path("Gerd_Müller".html_safe)) + link_to("Gerd Müller", article_path("Gerd_Müller")) ) end @@ -369,7 +369,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_link_tag_does_not_escape_html_safe_content assert_dom_equal %{Malicious }, - link_to("Malicious ".html_safe, "/") + link_to(raw("Malicious "), "/") end def test_link_to_unless @@ -380,7 +380,7 @@ class UrlHelperTest < ActiveSupport::TestCase assert_equal "Showing", link_to_unless(true, "Showing", url_hash) { |name| - "#{name}".html_safe + raw "#{name}" } assert_equal "test", @@ -390,8 +390,8 @@ class UrlHelperTest < ActiveSupport::TestCase assert_equal %{<b>Showing</b>}, link_to_unless(true, "Showing", url_hash) assert_equal %{<b>Showing</b>}, link_to_unless(false, "Showing", url_hash) - assert_equal %{Showing}, link_to_unless(true, "Showing".html_safe, url_hash) - assert_equal %{Showing}, link_to_unless(false, "Showing".html_safe, url_hash) + assert_equal %{Showing}, link_to_unless(true, raw("Showing"), url_hash) + assert_equal %{Showing}, link_to_unless(false, raw("Showing"), url_hash) end def test_link_to_if @@ -541,13 +541,13 @@ class UrlHelperTest < ActiveSupport::TestCase def test_mail_to_with_img assert_dom_equal %{}, - mail_to('feedback@example.com', ''.html_safe) + mail_to('feedback@example.com', raw('')) end def test_mail_to_with_html_safe_string assert_dom_equal( %{david@loudthinking.com}, - mail_to("david@loudthinking.com".html_safe) + mail_to(raw("david@loudthinking.com")) ) end