diff options
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r-- | actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb index cbddf3481c..f70b47f32a 100644 --- a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb +++ b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb @@ -14,9 +14,12 @@ module ActionView class LinkSanitizer def initialize @link_scrubber = Loofah::Scrubber.new do |node| - next unless node.name == 'a' - node.before node.children - node.remove + if node.name == 'a' + node.before node.children + node.remove + else + Loofah::HTML5::Scrub.scrub_attributes(node) + end end end @@ -40,8 +43,8 @@ module ActionView @permit_scrubber.attributes = options[:attributes] loofah_fragment.scrub!(@permit_scrubber) else - loofah_fragment.scrub!(:strip) loofah_fragment.xpath("./form").each { |form| form.remove } + loofah_fragment.scrub!(:strip) end loofah_fragment.to_s end |