1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Files
svgo/test/plugins/inlineStyles.25.svg
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

33 lines
703 B
XML

Don't remove the redundant presentation attribute if it's used in a CSS
selector in a `<style> tag.
===
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50">
<style>
.a {
stroke: red;
}
[stroke] + path {
stroke: purple;
}
</style>
<path class="a" d="M10 10h20" stroke="red"/>
<path d="M10 20h20"/>
<path d="M10 30h20" stroke="yellow"/>
<path d="M10 40h20"/>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50">
<style>
[stroke]+path{stroke:purple}
</style>
<path d="M10 10h20" stroke="red" style="stroke:red"/>
<path d="M10 20h20"/>
<path d="M10 30h20" stroke="yellow"/>
<path d="M10 40h20"/>
</svg>