Don't remove unreferenced defs if --keep-unreferenced-defs is specified (#62)

* Don't remove unreferenced defs if `--keep-unreferenced-defs` is specified
(fixes #18)

* Add unittests for previous commit
This commit is contained in:
Eduard Braun 2016-08-14 18:52:55 +02:00 committed by GitHub
parent 3299f8f6e0
commit fe2884c3e8
3 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient">
<stop offset="0"/>
<stop offset="1" stop-color="blue"/>
</linearGradient>
<radialGradient id="radialGradient">
<stop offset="0"/>
<stop offset="1" stop-color="blue"/>
</radialGradient>
<pattern id="pattern">
<polygon fill="none" points="71.125,-1.896 2.125,-1.896 2.125,-70.896 71.125,-70.896"/>
</pattern>
<rect id="rect" width="50" height="50"/>
<circle id="circle" width="100" height="100"/>
</defs>
<use x="10" y="10" xlink:href="#rect" fill="url(#linearGradient)"/>
</svg>

After

Width:  |  Height:  |  Size: 729 B