Class: SvgOptimizer::Plugins::RemoveHiddenElement

Inherits:
Base
  • Object
show all
Defined in:
lib/svg_optimizer/plugins/remove_hidden_element.rb

Constant Summary collapse

SELECTOR =
%w[
  [display=none]
  [opacity='0']
  circle[r='0']
  ellipse[rx='0']
  ellipse[ry='0']
  rect[width='0']
  rect[height='0']
  pattern[width='0']
  pattern[height='0']
  image[width='0']
  image[height='0']
  path[d='']
  path:not([d])
  polyline[points='']
  polyline:not([points])
  polygon[points='']
  polygon:not([points])
].join(", ")

Instance Attribute Summary

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SvgOptimizer::Plugins::Base

Instance Method Details

#processObject



26
27
28
# File 'lib/svg_optimizer/plugins/remove_hidden_element.rb', line 26

def process
  xml.css(SELECTOR).remove
end