diff --git a/ChangeLog b/ChangeLog index 73e5ba95bb..5a80d188a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Oct 24 21:05:38 2008 Takeyuki FUJIOKA + + * lib/cgi/html.rb: allow symbolized key. + + * test/cgi/test_cgi_tag_helper.rb: add a test. + Fri Oct 24 20:54:53 2008 Nobuyoshi Nakada * common.mk (exts): renamed to get rid of the existent directory. diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb index 74aa730be7..62f1fc1898 100644 --- a/lib/cgi/html.rb +++ b/lib/cgi/html.rb @@ -27,11 +27,11 @@ class CGI attributes={attributes=>nil} if attributes.kind_of?(String) "<#{element.upcase}" + attributes.collect{|name, value| next unless value - " " + CGI::escapeHTML(name) + + " " + CGI::escapeHTML(name.to_s) + if true == value "" else - '="' + CGI::escapeHTML(value) + '"' + '="' + CGI::escapeHTML(value.to_s) + '"' end }.join + ">" END diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb index 618130b822..f28146a026 100755 --- a/test/cgi/test_cgi_tag_helper.rb +++ b/test/cgi/test_cgi_tag_helper.rb @@ -318,6 +318,7 @@ class CGITagHelperTest < Test::Unit::TestCase assert_match(/^bbdd$/,str) assert_match(/^bbdd$/,str) assert_match(/^bbdd$/,str) + assert_match(//,cgi.text_field(:name=>"name",:value=>"value")) if RUBY_VERSION>="1.9" str=cgi.radio_group("foo",["aa","bb"],["cc","dd",false]) assert_match(/^bbdd$/,str)