diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index fa9e54b8fd..7858d9296e 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Clean up multiple calls to #stringify_keys in TagHelper, add better documentation and testing for TagHelper. Closes #6394 [Bob Silva]
+
* [DOCS] fix reference to ActionController::Macros::AutoComplete for #text_field_with_auto_complete. Closes #2578 [Jan Prill]
* Make sure html_document is reset between integration test requests. [ctm]
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index 219888adb5..0e99cfab65 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -2,30 +2,48 @@ require 'cgi'
require 'erb'
module ActionView
- module Helpers
- # This is poor man's Builder for the rare cases where you need to programmatically make tags but can't use Builder.
+ module Helpers #:nodoc:
+ # Use these methods to generate HTML tags programmatically when you can't use
+ # a Builder. By default, they output XHTML compliant tags.
module TagHelper
include ERB::Util
- # Examples:
- # * tag("br") =>
- # * tag("input", { "type" => "text"}) =>
+ # Returns an empty HTML tag of type +name+ which by default is XHTML
+ # compliant. Setting +open+ to true will create an open tag compatible
+ # with HTML 4.0 and below. Add HTML attributes by passing an attributes
+ # hash to +options+. For attributes with no value like (disabled and
+ # readonly), give it a value of true in the +options+ hash. You can use
+ # symbols or strings for the attribute names.
+ #
+ # tag("br")
+ # # =>
+ # tag("br", nil, true)
+ # # =>
+ # tag("input", { :type => 'text', :disabled => true })
+ # # =>
def tag(name, options = nil, open = false)
- "<#{name}#{tag_options(options.stringify_keys) if options}" + (open ? ">" : " />")
+ "<#{name}#{tag_options(options) if options}" + (open ? ">" : " />")
end
- # Examples:
- # * content_tag(:p, "Hello world!") =>
Hello world!
- # * content_tag(:div, content_tag(:p, "Hello world!"), :class => "strong") => - #Hello world!
Hello world!
+ # content_tag(:div, content_tag(:p, "Hello world!"), :class => "strong") + # # =>Hello world!
Hello world!
Hello world!