aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/sanitize_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/sanitize_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/sanitize_helper.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb
index 657d26f0a2..28e40f8560 100644
--- a/actionpack/lib/action_view/helpers/sanitize_helper.rb
+++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb
@@ -50,11 +50,7 @@ module ActionView
# confuse browsers.
#
def sanitize(html, options = {})
- returning self.class.white_list_sanitizer.sanitize(html, options) do |sanitized|
- if sanitized
- sanitized.html_safe!
- end
- end
+ self.class.white_list_sanitizer.sanitize(html, options).try(:html_safe)
end
# Sanitizes a block of CSS code. Used by +sanitize+ when it comes across a style attribute.
@@ -77,11 +73,7 @@ module ActionView
# strip_tags("<div id='top-bar'>Welcome to my website!</div>")
# # => Welcome to my website!
def strip_tags(html)
- returning self.class.full_sanitizer.sanitize(html) do |sanitized|
- if sanitized
- sanitized.html_safe!
- end
- end
+ self.class.full_sanitizer.sanitize(html).try(:html_safe)
end
# Strips all link tags from +text+ leaving just the link text.