diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 159b2a2b8e3d85705609671475a0ec71b76202ca..d6b74974e9a1826b515f5a2cd16bfdca04706105 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -457,7 +457,7 @@ def button_tag(label = "Button", options = {}) options[option] = "button" unless options[option] end - content_tag :button, label.to_s.html_safe, { "type" => options.delete("type") }.update(options) + content_tag :button, label, { "type" => options.delete("type") }.update(options) end # Displays an image which when clicked will submit the form. diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 0d29b962d5a54d9689026f177df75108a9681ded..4a584b8db87b20a142da20ee86aac471a857016e 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -413,6 +413,13 @@ def test_button_tag_with_disabled_option ) end + def test_button_tag_escape_content + assert_dom_equal( + %(), + button_tag("Reset", :type => "reset", :disabled => true) + ) + end + def test_image_submit_tag_with_confirmation assert_dom_equal( %(),