Skip to content

Commit

Permalink
some things do not need to be escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoward committed Dec 28, 2013
1 parent 989b55b commit 361f3d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lib/dao/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ def input(*args, &block)
block ? block.call(attributes.get(keys)) : options.delete(:value)
end

value = escape_html(value)

input_(options_for(options, :type => type, :name => name, :value => value, :class => klass, :id => id, :data_error => error)){}
end

Expand Down Expand Up @@ -250,7 +248,6 @@ def button(*args, &block)

content = (block ? block.call : (options.delete(:content) || 'Submit'))

value = escape_html(value)
content = escape_html(content)

button_(options_for(options, :type => type, :name => name, :value => value, :class => klass, :id => id, :data_error => error)){ content }
Expand Down Expand Up @@ -549,7 +546,7 @@ def value_for(map, keys)
value
end

escape_html(value)
value.to_s
end

def escape_html(string)
Expand Down
6 changes: 3 additions & 3 deletions test/form_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
html = form.input(:bar)
scmp(
html,
'<input type="text" name="dao[form][bar]" value="" class="dao" id="form_bar"/>'
'<input type="text" name="dao[form][bar]" class="dao" id="form_bar"/>'
)
end

Expand All @@ -28,7 +28,7 @@
html = form.input(:bar)
scmp(
html,
'<input type="text" name="dao[form][foo.bar]" value="" class="dao" id="form_foo-bar"/>'
'<input type="text" name="dao[form][foo.bar]" class="dao" id="form_foo-bar"/>'
)
end
end
Expand All @@ -37,7 +37,7 @@
html = form.input(:bar)
scmp(
html,
'<input type="text" name="dao[form][bar]" value="" class="dao" id="form_bar"/>'
'<input type="text" name="dao[form][bar]" class="dao" id="form_bar"/>'
)
end
end
Expand Down

0 comments on commit 361f3d4

Please sign in to comment.