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.html5_fragment(unsafe_html).scrub!(:prune) => "ohai! <div>div is safe</div> "
Public Class Methods
Source
# File lib/loofah/scrubbers.rb, line 138 def initialize # rubocop:disable Lint/MissingSuper @direction = :top_down end
Public Instance Methods
Source
# File lib/loofah/scrubbers.rb, line 142 def scrub(node) return CONTINUE if html5lib_sanitize(node) == CONTINUE node.remove STOP end