Commit
…. 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("</form>".html_safe), you can do safe_concat("</form>"), 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.
- Loading branch information
There are no files selected for viewing
This file was deleted.
5 comments
on commit 4cbb9db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, breaks HAML (edge) :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jesus, another yak queuing up for being shaved :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! Making all String be html_safe? by default caused operations like + and << be dog slow, even on String literals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it turns out the Haml guys have already done their homework and 2.2.18 is fine with the new model. Definitely a nice improvement in speed!
Sorry, why there should be 'html_safe' on javascript_src_tag?
Because when I write:
<%= javascript_include_tag "prototype-base-extensions", "prototype-date-extensions", "datepicker" %>
I constantly get this in my HTML:
<script src="/javascripts/prototype-base-extensions.js?1286905348" type="text/javascript"></script>
<script src="/javascripts/prototype-date-extensions.js?1286905348" type="text/javascript"></script>
<script src="/javascripts/datepicker.js?1286905348" type="text/javascript"></script>
so I should do something like this:
<%= raw(javascript_include_tag "prototype-base-extensions", "prototype-date-extensions", "datepicker") %>
I use rails3.0.0 / ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02
Am I the only one who encountered this issue too?