aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tag_helper.rb
diff options
context:
space:
mode:
authorPaoMar <paomarcasadiego@gmail.com>2014-09-03 15:03:58 -0500
committerPaoMar <paomarcasadiego@gmail.com>2014-09-03 16:14:21 -0500
commitee61b76a810ad67ca064be2922a8b481fa840043 (patch)
treef653efa7c90db7f10f071502851942afb2b314c7 /actionview/lib/action_view/helpers/tag_helper.rb
parentb79ab4ca953949d953db772ba40bef2adc936fc3 (diff)
downloadrails-ee61b76a810ad67ca064be2922a8b481fa840043.tar.gz
rails-ee61b76a810ad67ca064be2922a8b481fa840043.tar.bz2
rails-ee61b76a810ad67ca064be2922a8b481fa840043.zip
Add support for ARIA attributes in tags
Diffstat (limited to 'actionview/lib/action_view/helpers/tag_helper.rb')
-rw-r--r--actionview/lib/action_view/helpers/tag_helper.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb
index 268558669e..f200d424c0 100644
--- a/actionview/lib/action_view/helpers/tag_helper.rb
+++ b/actionview/lib/action_view/helpers/tag_helper.rb
@@ -148,9 +148,9 @@ module ActionView
return if options.blank?
attrs = []
options.each_pair do |key, value|
- if key.to_s == 'data' && value.is_a?(Hash)
+ if (key.to_s == 'data' || key.to_s == 'aria') && value.is_a?(Hash)
value.each_pair do |k, v|
- attrs << data_tag_option(k, v, escape)
+ attrs << prefix_tag_option(key, k, v, escape)
end
elsif BOOLEAN_ATTRIBUTES.include?(key)
attrs << boolean_tag_option(key) if value
@@ -161,8 +161,8 @@ module ActionView
" #{attrs.sort! * ' '}" unless attrs.empty?
end
- def data_tag_option(key, value, escape)
- key = "data-#{key.to_s.dasherize}"
+ def prefix_tag_option(prefix, key, value, escape)
+ key = "#{prefix}-#{key.to_s.dasherize}"
unless value.is_a?(String) || value.is_a?(Symbol) || value.is_a?(BigDecimal)
value = value.to_json
end