1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Files
svgo/docs/03-plugins/remove-empty-text.mdx
Seth Falco 4c2cc1bbdb feat(inlineStyles): remove redundant presentation attrs (#1829)
SVGs can have the same presentation attribute declared redundantly in
both the node attributes and `<style>` tag.

This wouldn't break anything, but we can shave off a few more bytes by
dropping the attribute in this case.
2023-11-11 12:43:13 +00:00

41 lines
1.2 KiB
Plaintext

---
title: Remove Empty Text
svgo:
pluginId: removeEmptyText
defaultPlugin: true
parameters:
text:
description: If to remove empty <a href="https://developer.mozilla.org/docs/Web/SVG/Element/text" target="_blank"><code>&lt;text&gt;</code></a> elements.
default: true
tspan:
description: If to remove empty <a href="https://developer.mozilla.org/docs/Web/SVG/Element/tspan" target="_blank"><code>&lt;tspan&gt;</code></a> elements.
default: true
tref:
description: If to remove empty <a href="https://developer.mozilla.org/docs/Web/SVG/Element/tref" target="_blank"><code>&lt;tref&gt;</code></a> elements.
default: true
---
Removes empty [`<text>`](https://developer.mozilla.org/docs/Web/SVG/Element/text) and [`<tspan>`](https://developer.mozilla.org/docs/Web/SVG/Element/tspan) elements, and [`<tref>`](https://developer.mozilla.org/docs/Web/SVG/Element/tref) elements that don't reference another node in the document.
:::info
No browsers supports `<tref>`, so it's best to avoid that element regardless.
:::
## Usage
<PluginUsage/>
### Parameters
<PluginParams/>
## Demo
<PluginDemo/>
## Implementation
* https://github.com/svg/svgo/blob/main/plugins/removeEmptyText.js