class Sanitize::Transformers::CleanElement

def initialize(config)

def initialize(config)
  @add_attributes = config[:add_attributes]
  @attributes = config[:attributes].dup
  @elements = config[:elements]
  @protocols = config[:protocols]
  @remove_all_contents = false
  @remove_element_contents = Set.new
  @whitespace_elements = {}
  @attributes.each do |element_name, attrs|
    unless element_name == :all
      @attributes[element_name] = Set.new(attrs).merge(@attributes[:all] || [])
    end
  end
  # Backcompat: if :whitespace_elements is a Set, convert it to a hash.
  if config[:whitespace_elements].is_a?(Set)
    config[:whitespace_elements].each do |element|
      @whitespace_elements[element] = {before: " ", after: " "}
    end
  else
    @whitespace_elements = config[:whitespace_elements]
  end
  if config[:remove_contents].is_a?(Enumerable)
    @remove_element_contents.merge(config[:remove_contents].map(&:to_s))
  else
    @remove_all_contents = !!config[:remove_contents]
  end
end