Skip to content
petercollingridge edited this page Feb 1, 2012 · 3 revisions

Automatically-generated SVGs often use various attributes that aren't don't affect how to the image is displayed. For example, often, all elements are given an id attributes which aren't used for styling or animations.

Method

To remove an attribute, x, call: svg.removeAttributes(x)

Multiple attributes can be removed by calling the method with a comma-separated list. e.g. svg.removeAttributes(x, y, z)

Usage note

Often SVGs will contain many attributes from associated with a namespace, which aren't required. For example, elements in Inkscape SVGs often contain attributes prefixed with 'sodipodi:'. To remove all of these, use the removeNamespace() method.

Clone this wiki locally