aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tag_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 11:31:54 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 11:31:54 +0000
commit0990c1309dfa1751c1e1a48b48bfcb994ab68db0 (patch)
treea383003b620fc5a771d00ebd4429542a298e130d /actionpack/lib/action_view/helpers/tag_helper.rb
parent85a5deacdc1f0d1a56a07429a03dfa0cf8cc7f78 (diff)
downloadrails-0990c1309dfa1751c1e1a48b48bfcb994ab68db0.tar.gz
rails-0990c1309dfa1751c1e1a48b48bfcb994ab68db0.tar.bz2
rails-0990c1309dfa1751c1e1a48b48bfcb994ab68db0.zip
Fixed all helpers so that they use XHTML compliant double quotes for values instead of single quotes [htonl/bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@114 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index 13aa9297ca..6139943567 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -10,7 +10,7 @@ module ActionView
# * tag("br") => <br />
# * tag("input", { "type" => "text"}) => <input type="text" />
def tag(name, options = {}, open = false)
- "<#{name + tag_options(options)}" + (open ? ">" : " />")
+ "<#{name}#{tag_options(options)}" + (open ? ">" : " />")
end
# Examples:
@@ -18,7 +18,7 @@ module ActionView
# * content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") =>
# <div class="strong"><p>Hello world!</p></div>
def content_tag(name, content, options = {})
- "<#{name + tag_options(options)}>#{content}</#{name}>"
+ "<#{name}#{tag_options(options)}>#{content}</#{name}>"
end
# Starts a form tag that points the action to an url configured with <tt>url_for_options</tt> just like
@@ -46,12 +46,10 @@ module ActionView
private
def tag_options(options)
- if options.empty?
- ""
- else
- " " + options.collect { |pair|
- "#{pair.first}=\"#{html_escape(pair.last)}\""
- }.sort.join(" ")
+ unless options.empty?
+ " " + options.map { |key, value|
+ %(#{key}="#{html_escape(value)}")
+ }.sort.join(" ")
end
end
end