module Loofah::ScrubBehavior::Node

def scrub!(scrubber)

:nodoc:
def scrub!(scrubber)
  #
  #  yes. this should be three separate methods. but nokogiri decorates (or not) based on
  #  whether the module name has already been included. and since documents get decorated just
  #  like their constituent nodes, we need to jam all the logic into a single module.
  #
  scrubber = ScrubBehavior.resolve_scrubber(scrubber)
  case self
  when Nokogiri::XML::Document
    scrubber.traverse(root) if root
  when Nokogiri::XML::DocumentFragment
    children.scrub!(scrubber)
  else
    scrubber.traverse(self)
  end
  self
end