diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 0835258d5e..c27933445a 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed JavaScriptHelper#escape_javascript to also escape closing tags #8023 [rubyruy] + * Fixed TextHelper#word_wrap for multiline strings with extra carrier returns #8663 [seth] * Fixed that setting the :host option in url_for would automatically turn off :only_path (since :host would otherwise not be shown) #9586 [Bounga] diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 45a5791efe..8e7542e206 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -149,7 +149,7 @@ module ActionView # Escape carrier returns and single and double quotes for JavaScript segments. def escape_javascript(javascript) - (javascript || '').gsub('\\','\0\0').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" } + (javascript || '').gsub('\\','\0\0').gsub(' tags), escape_javascript(%(dont tags)) end def test_link_to_function