diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-12 20:15:02 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-12 22:29:56 -0200 |
commit | cfee068b627a2aaf066bf003f678e50c8695e62c (patch) | |
tree | d3a7cccb99c252cd2be0b6b76c40ccc3fbd47bca | |
parent | c4c1c252e27f18daf4e26d2003077ae005489909 (diff) | |
download | rails-cfee068b627a2aaf066bf003f678e50c8695e62c.tar.gz rails-cfee068b627a2aaf066bf003f678e50c8695e62c.tar.bz2 rails-cfee068b627a2aaf066bf003f678e50c8695e62c.zip |
Delegate data tag option to tag option for escaping
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index e5fd11e021..d7a2651bad 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -134,7 +134,7 @@ module ActionView attrs = [] options.each_pair do |key, value| if key.to_s == 'data' && value.is_a?(Hash) - value.each do |k, v| + value.each_pair do |k, v| attrs << data_tag_option(k, v, escape) end elsif BOOLEAN_ATTRIBUTES.include?(key) @@ -146,10 +146,11 @@ module ActionView " #{attrs.sort * ' '}".html_safe unless attrs.empty? end - def data_tag_option(k, v, escape) - v = v.to_json if !v.is_a?(String) && !v.is_a?(Symbol) - v = ERB::Util.h(v) if escape - %(data-#{k.to_s.dasherize}="#{v}") + def data_tag_option(key, value, escape) + key = "data-#{key.to_s.dasherize}" + value = value.to_json if !value.is_a?(String) && !value.is_a?(Symbol) + + tag_option(key, value, escape) end def boolean_tag_option(key) |