• Heinrich Lee Yu's avatar
    Fix HTML escaping in StringRangeMarker · 5dfddb5f
    Heinrich Lee Yu authored
    Rails now handles html_safe when using string ranges
    to replace text.
    
    We need to mark the replacement text as HTML-safe so that it
    doesn't get escaped when it gets inserted into the HTML-safe
    string.
    
    Example:
    
    string = "<p>Hello</p>".html_safe
    string[3..4] = "<b>He</b>"
    
    "<p>&lt;b&gt;He&lt;/b&gt;llo</p>"
    
    Correct way:
    
    string = "<p>Hello</p>".html_safe
    string[3..4] = "<b>He</b>".html_safe
    
    "<p><b>He</b>llo</p>"
    5dfddb5f
string_range_marker_spec.rb 1.33 KB