mirror of
https://github.com/svg/svgo.git
synced 2026-01-27 07:02:06 +03:00
37 lines
1.4 KiB
Plaintext
37 lines
1.4 KiB
Plaintext
---
|
|
title: Remove Empty Containers
|
|
svgo:
|
|
pluginId: removeEmptyContainers
|
|
defaultPlugin: true
|
|
---
|
|
|
|
Remove container elements in the document that have no children or meaningful attributes.
|
|
|
|
A container, as defined in the [SVG specifications](https://www.w3.org/TR/SVG11/intro.html#TermContainerElement), is an SVG element that can have graphical child elements. Container elements include:
|
|
|
|
* [`<a>`](https://developer.mozilla.org/docs/Web/SVG/Element/a)
|
|
* [`<defs>`](https://developer.mozilla.org/docs/Web/SVG/Element/defs)
|
|
* [`<glyph>`](https://developer.mozilla.org/docs/Web/SVG/Element/glyph)
|
|
* [`<g>`](https://developer.mozilla.org/docs/Web/SVG/Element/g)
|
|
* [`<marker>`](https://developer.mozilla.org/docs/Web/SVG/Element/marker)
|
|
* [`<mask>`](https://developer.mozilla.org/docs/Web/SVG/Element/mask)
|
|
* [`<missing-glyph>`](https://developer.mozilla.org/docs/Web/SVG/Element/missing-glyph)
|
|
* [`<pattern>`](https://developer.mozilla.org/docs/Web/SVG/Element/pattern)
|
|
* [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg)
|
|
* [`<switch>`](https://developer.mozilla.org/docs/Web/SVG/Element/switch)
|
|
* [`<symbol>`](https://developer.mozilla.org/docs/Web/SVG/Element/symbol)
|
|
|
|
Despite the `<svg>` element being a container element, they are not ignored by this plugin.
|
|
|
|
## Usage
|
|
|
|
<PluginUsage/>
|
|
|
|
## Demo
|
|
|
|
<PluginDemo/>
|
|
|
|
## Implementation
|
|
|
|
* https://github.com/svg/svgo/blob/main/plugins/removeEmptyContainers.js
|