aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-08-10 12:54:44 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:04:04 +0200
commit39df4028a2816b96de3127d68d9c42687da4178e (patch)
treefc48e662850ab734992ee687f569e28f02569769 /actionview/lib/action_view
parent557806f4022a5d49a5a651b703879f8a802a2db2 (diff)
downloadrails-39df4028a2816b96de3127d68d9c42687da4178e.tar.gz
rails-39df4028a2816b96de3127d68d9c42687da4178e.tar.bz2
rails-39df4028a2816b96de3127d68d9c42687da4178e.zip
Refactored scrub to keep_node? instead of scrub_node calling it. Also added ability to stop traversing by returning STOP from scrub_node.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r--actionview/lib/action_view/helpers/sanitize_helper/scrubbers.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/sanitize_helper/scrubbers.rb b/actionview/lib/action_view/helpers/sanitize_helper/scrubbers.rb
index 1f2df3b108..07611e6927 100644
--- a/actionview/lib/action_view/helpers/sanitize_helper/scrubbers.rb
+++ b/actionview/lib/action_view/helpers/sanitize_helper/scrubbers.rb
@@ -33,7 +33,9 @@ class PermitScrubber < Loofah::Scrubber
def scrub(node)
return CONTINUE if skip_node?(node)
- return STOP if scrub_node(node)
+ unless keep_node?(node)
+ return STOP if scrub_node(node) == STOP
+ end
scrub_attributes(node)
end
@@ -61,11 +63,8 @@ class PermitScrubber < Loofah::Scrubber
end
def scrub_node(node)
- unless keep_node?(node)
- node.before(node.children) # strip
- node.remove
- true
- end
+ node.before(node.children) # strip
+ node.remove
end
def scrub_attributes(node)