aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-08-09 23:18:37 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:04:03 +0200
commit1cdc511b90eee7351f21359c32c6d13385846dbd (patch)
tree356c4e8b757b2f800194fb0841a2d43fb1c74ef8 /actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb
parent739ecdf753d35ba40e238aedec666bc5eeafb2cc (diff)
downloadrails-1cdc511b90eee7351f21359c32c6d13385846dbd.tar.gz
rails-1cdc511b90eee7351f21359c32c6d13385846dbd.tar.bz2
rails-1cdc511b90eee7351f21359c32c6d13385846dbd.zip
Added LinkScrubber to remove duplication in LinkSanitizer. As such made PermitScrubber easier to subclass.
Diffstat (limited to 'actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb')
-rw-r--r--actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb
index 3ba46ccaa9..905fa38446 100644
--- a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb
+++ b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb
@@ -1,6 +1,6 @@
require 'active_support/core_ext/class/attribute'
require 'active_support/deprecation'
-require 'action_view/helpers/sanitize_helper/permit_scrubber'
+require 'action_view/helpers/sanitize_helper/scrubbers'
module ActionView
XPATHS_TO_REMOVE = %w{.//script .//form comment()}
@@ -34,15 +34,7 @@ module ActionView
class LinkSanitizer < Sanitizer
def initialize
- @strip_tags = %w(a href)
- @link_scrubber = Loofah::Scrubber.new do |node|
- if @strip_tags.include?(node.name)
- node.before node.children
- node.remove
- else
- Loofah::HTML5::Scrub.scrub_attributes(node)
- end
- end
+ @link_scrubber = LinkScrubber.new
end
def sanitize(html, options = {})