class Loofah::Scrubbers::Strip
scrub!(:strip)¶ ↑
:strip
removes unknown/unsafe tags, but leaves behind the pristine contents:
unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>" Loofah.html5_fragment(unsafe_html).scrub!(:strip) => "ohai! <div>div is safe</div> but foo is <b>not</b>"
Public Class Methods
new()
click to toggle source
# File lib/loofah/scrubbers.rb, line 115 def initialize # rubocop:disable Lint/MissingSuper @direction = :bottom_up end
Public Instance Methods
scrub(node)
click to toggle source
# File lib/loofah/scrubbers.rb, line 119 def scrub(node) return CONTINUE if html5lib_sanitize(node) == CONTINUE node.before(node.children) node.remove STOP end