diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-03 18:31:04 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-03 18:31:04 -0300 |
commit | faa0f324345f48c9f41f02c626055a7fadf1ddf4 (patch) | |
tree | f0d67b1c7da2d0f6788eb8923cb45deef63168e8 /actionview/lib | |
parent | a794fd2c0a99e7e917f6dbf83d781f621a39f3ad (diff) | |
download | rails-faa0f324345f48c9f41f02c626055a7fadf1ddf4.tar.gz rails-faa0f324345f48c9f41f02c626055a7fadf1ddf4.tar.bz2 rails-faa0f324345f48c9f41f02c626055a7fadf1ddf4.zip |
Extract data/aria attribute prefixes to a constant
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/tag_helper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index f200d424c0..c20800598f 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -20,6 +20,8 @@ module ActionView BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attribute| attribute.to_sym }) + TAG_PREFIXES = ['aria', 'data', :aria, :data].to_set + PRE_CONTENT_STRINGS = { :textarea => "\n" } @@ -148,7 +150,7 @@ module ActionView return if options.blank? attrs = [] options.each_pair do |key, value| - if (key.to_s == 'data' || key.to_s == 'aria') && value.is_a?(Hash) + if TAG_PREFIXES.include?(key) && value.is_a?(Hash) value.each_pair do |k, v| attrs << prefix_tag_option(key, k, v, escape) end |