Changeset 154

Show
Ignore:
Timestamp:
07/04/2007 17:36:01 (17 months ago)
Author:
why
Message:
  • lib/hpricot/tag.rb: bug in quoting of attributes, found by mikel lindsaar.
Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/hpricot/tag.rb

    r139 r154  
    101101        @raw_attributes.map do |aname, aval| 
    102102          " #{aname}" + 
    103             (aval ? "=\"#{aval}\"" : "") 
     103            (aval ? "=#{html_quote aval}" : "") 
    104104        end.join 
    105105      end 
  • trunk/test/test_builder.rb

    r125 r154  
    2222    assert_equal "\342\202\254\342\200\242", doc.at("text()").to_s 
    2323  end 
     24 
     25  def test_escaping_attrs 
     26    text = "<span style='font-family:\"MS Mincho\"'>Some text</span>" 
     27    assert_equal "<span style=\"font-family:\\\"MS Mincho\\\"\">Some text</span>", 
     28      Hpricot(text).to_html 
     29  end 
    2430end