Merge pull request #38073 from benubois/escape_javascript

Improve escape_javascript performance.
This commit is contained in:
Kasper Timm Hansen 2019-12-23 00:55:59 +01:00 committed by GitHub
commit d2ae2c3103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ module ActionView
if javascript.empty?
result = ""
else
result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u) { |match| JS_ESCAPE_MAP[match] }
result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u, JS_ESCAPE_MAP)
end
javascript.html_safe? ? result.html_safe : result
end