This project is archived and is in readonly mode.

Changeset [4cbb9db0a5ff65b0a626a5b043331abefd89e717] by Yehuda Katz

February 1st, 2010 @ 03:39 AM

For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).

  • Additionally, instead of doing concat("".html_safe), you can do safe_concat(""), which will skip both the flag set, and the flag check.
  • For the first pass, I converted virtually all #html_safe!s to #html_safe, and the tests pass. A further optimization would be to try to use

    safe_concat as much as possible, reducing the performance impact if

    we know up front that a String is safe. http://github.com/rails/rails/commit/4cbb9db0a5ff65b0a626a5b043331a...

Committed by Yehuda Katz

  • R actionpack/lib/action_view/erb/util.rb
  • R actionpack/lib/action_view/safe_buffer.rb
  • M actionpack/lib/action_view.rb
  • M actionpack/lib/action_view/base.rb
  • M actionpack/lib/action_view/helpers/active_model_helper.rb
  • M actionpack/lib/action_view/helpers/asset_tag_helper.rb
  • M actionpack/lib/action_view/helpers/date_helper.rb
  • M actionpack/lib/action_view/helpers/debug_helper.rb
  • M actionpack/lib/action_view/helpers/form_helper.rb
  • M actionpack/lib/action_view/helpers/form_options_helper.rb
  • M actionpack/lib/action_view/helpers/form_tag_helper.rb
  • M actionpack/lib/action_view/helpers/number_helper.rb
  • M actionpack/lib/action_view/helpers/prototype_helper.rb
  • M actionpack/lib/action_view/helpers/raw_output_helper.rb
  • M actionpack/lib/action_view/helpers/sanitize_helper.rb
  • M actionpack/lib/action_view/helpers/tag_helper.rb
  • M actionpack/lib/action_view/helpers/text_helper.rb
  • M actionpack/lib/action_view/helpers/translation_helper.rb
  • M actionpack/lib/action_view/helpers/url_helper.rb
  • M actionpack/lib/action_view/render/partials.rb
  • M actionpack/lib/action_view/test_case.rb
  • M actionpack/test/controller/caching_test.rb
  • M actionpack/test/controller/output_escaping_test.rb
  • M actionpack/test/template/erb_util_test.rb
  • M actionpack/test/template/form_helper_test.rb
  • M actionpack/test/template/form_tag_helper_test.rb
  • M actionpack/test/template/safe_buffer_test.rb
  • M actionpack/test/template/test_case_test.rb
  • M activesupport/lib/active_support.rb
  • M activesupport/lib/active_support/core_ext/string/output_safety.rb
  • M activesupport/test/core_ext/string_ext_test.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>