app/helpers/rjs_helper.rb in rjs_helpers-0.0.4 vs app/helpers/rjs_helper.rb in rjs_helpers-1.0

- old
+ new

@@ -132,27 +132,18 @@ %{rjsHelpers.#{js_function}(#{string_args(js_args)});} end end def string_args(args) - args.map {|a| a.is_a?(Numeric) ? a : ('"' + fixed_escape_javascript(a.to_s) + '"')}.join(', ') + args.map {|a| a.is_a?(Numeric) ? a : "'#{a}'"}.join(', ') end # Processes the given content. # Strings are simply forwarded while Hashes # are passed to Rails' +render+ function. # Also, it automatically escapes javascript in the given content #-------------------------------------------------------------- def rendered_content(content) - content.is_a?(Hash) ? render(content) : content - end - - # - # The Rails +escape_javascript+ helper does not seem to automatically - # escape unicode newline elements which causes javascript strings - # to break. This method escapes these sequences. - # - def fixed_escape_javascript(text) - escape_javascript(text).gsub("\342\200\250", "
") + escape_javascript(content.is_a?(Hash) ? render(content) : content) end end