Skip to content

Commit

Permalink
feat($core): handles more attributes in attributes validation
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Feb 4, 2014
1 parent 1c01c72 commit f03381d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/awesome_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ module AwesomeForm

mattr_accessor :legal_attributes
@@legal_attributes = {
global: %w(accesskey class contenteditable contextmenu dir draggable dropzone hidden id inert itemid itemprop itemref itemscope itemtype lang spellcheck style tabindex title translate).map(&:to_sym),
input: %w(accept alt autocomplete autofocus checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern placeholder readonly required size src step type value width).map(&:to_sym),
textarea: %w(autocomplete autofocus cols dirname disabled form maxlength name placeholder readonly required rows wrap).map(&:to_sym),
select: %w(autofocus disabled form multiple name required size).map(&:to_sym)
select: %w(autofocus disabled form multiple name required size).map(&:to_sym),
label: %w(form for).map(&:to_sym),
}

def self.setup
Expand Down
1 change: 1 addition & 0 deletions lib/awesome_form/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def lookup_views(paths)

def filter_attributes_for(html, options)
options.select do |k|
AwesomeForm.legal_attributes[:global].include?(k) ||
AwesomeForm.legal_attributes[html].include?(k) ||
k.to_s =~ /^data($|-)/
end
Expand Down

0 comments on commit f03381d

Please sign in to comment.