Class: Loofah::Scrubbers::Prune
- Inherits:
-
Loofah::Scrubber
- Object
- Loofah::Scrubber
- Loofah::Scrubbers::Prune
- Defined in:
- lib/loofah/scrubbers.rb
Overview
scrub!(:prune)
+:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
Loofah.fragment(unsafe_html).scrub!(:prune)
=> "ohai! <div>div is safe</div> "
Constant Summary
Constant Summary
Constants inherited from Loofah::Scrubber
Loofah::Scrubber::CONTINUE, Loofah::Scrubber::STOP
Instance Attribute Summary
Attributes inherited from Loofah::Scrubber
Instance Method Summary (collapse)
-
- (Prune) initialize
constructor
A new instance of Prune.
- - (Object) scrub(node)
Methods inherited from Loofah::Scrubber
Constructor Details
- (Prune) initialize
A new instance of Prune
93 94 95 |
# File 'lib/loofah/scrubbers.rb', line 93 def initialize @direction = :top_down end |
Instance Method Details
- (Object) scrub(node)
97 98 99 100 101 |
# File 'lib/loofah/scrubbers.rb', line 97 def scrub(node) return CONTINUE if html5lib_sanitize(node) == CONTINUE node.remove return STOP end |