class Loofah::Scrubbers::Prune

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> "

Public Class Methods

new() click to toggle source
# File lib/loofah/scrubbers.rb, line 108
def initialize
  @direction = :top_down
end

Public Instance Methods

scrub(node) click to toggle source
# File lib/loofah/scrubbers.rb, line 112
def scrub(node)
  return CONTINUE if html5lib_sanitize(node) == CONTINUE
  node.remove
  return STOP
end