1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

Don't move transform attribute to elems if there is linked object to transform. Fixes #162

This commit is contained in:
GreLI
2014-11-04 21:01:03 +03:00
parent 592fdfe03f
commit 17d29e9138
2 changed files with 16 additions and 0 deletions

View File

@ -35,6 +35,7 @@ exports.fn = function(item) {
item.isElem('g') && item.isElem('g') &&
item.hasAttr('transform') && item.hasAttr('transform') &&
!item.isEmpty() && !item.isEmpty() &&
!item.someAttr(function(attr) { return ~attr.value.indexOf('url(') }) &&
item.content.every(function(inner) { item.content.every(function(inner) {
return inner.isElem(pathElems); return inner.isElem(pathElems);
}) })

View File

@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g transform="scale(2)" clip-path="url(#a)">
<path d="M0,0 L10,20"/>
<path d="M0,10 L20,30"/>
</g>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg">
<g transform="scale(2)" clip-path="url(#a)">
<path d="M0,0 L10,20"/>
<path d="M0,10 L20,30"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 348 B