Closed ghazel closed 14 years ago
This can't be implemented without completely overriding Array#join, unfortunately this was too intrusive and expensive, you'll have to manually mark those strings as safe.
Overring Array#join was too expensive, but overriding String#+ was not?
How about something like this?
class Array def html_safe_join(s) if s.html_safe? and all?{|x| x.html_safe? } return join(s).html_safe! end join(s) end end
Overriding String#+ actually was pretty expensive, so it's not there in master any more. where a simpler and more consistent approach is taken.
http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/
So yeah, I'll leave this closed
String addition seems to make the output html_safe if the components were, but String#join does not. I believe it should be safe. Is there some case where it won't be?