mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #38073 from benubois/escape_javascript
Improve escape_javascript performance.
This commit is contained in:
commit
d2ae2c3103
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue