Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeNonInheritableGroupAttrs losing data #116

Closed
davidlwarner opened this issue May 10, 2013 · 1 comment
Closed

removeNonInheritableGroupAttrs losing data #116

davidlwarner opened this issue May 10, 2013 · 1 comment
Assignees
Labels

Comments

@davidlwarner
Copy link

This is the original SVG:

<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  --><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"  width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve"><circle fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" cx="10" cy="10" r="9"/><g>    <circle fill-rule="evenodd" clip-rule="evenodd" fill="#45A8C6" cx="9.999" cy="10" r="8.1"/> <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="9.9985" y1="6.1577" x2="9.9985" y2="15.4692">      <stop  offset="0" style="stop-color:#FFFFFF"/>      <stop  offset="1" style="stop-color:#000000"/>  </linearGradient>   <circle opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_1_)" cx="9.999" cy="10" r="8.1"/>    <g opacity="0.1">       <path fill="#231F20" d="M9.999,2.9c3.915,0,7.1,3.185,7.1,7.1s-3.185,7.1-7.1,7.1c-3.915,0-7.1-3.185-7.1-7.1S6.084,2.9,9.999,2.9           M9.999,1.9c-4.473,0-8.1,3.627-8.1,8.1c0,4.474,3.627,8.1,8.1,8.1c4.474,0,8.1-3.626,8.1-8.1C18.099,5.527,14.473,1.9,9.999,1.9            L9.999,1.9z"/>  </g></g><g> <defs>      <rect id="SVGID_2_" y="1" width="19" height="9"/>   </defs> <clipPath id="SVGID_3_">        <use xlink:href="#SVGID_2_"  overflow="visible"/>   </clipPath> <circle clip-path="url(#SVGID_3_)" fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" cx="10" cy="10" r="9"/>   <g clip-path="url(#SVGID_3_)">      <circle fill-rule="evenodd" clip-rule="evenodd" fill="#E85200" cx="9.999" cy="10" r="8.1"/>     <linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="9.9985" y1="6.1577" x2="9.9985" y2="15.4692">          <stop  offset="0" style="stop-color:#FFFFFF"/>          <stop  offset="1" style="stop-color:#000000"/>      </linearGradient>       <circle opacity="0.2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#SVGID_4_)" cx="9.999" cy="10" r="8.1"/>        <g opacity="0.1">           <path fill="#231F20" d="M9.999,2.9c3.915,0,7.1,3.185,7.1,7.1s-3.185,7.1-7.1,7.1c-3.915,0-7.1-3.185-7.1-7.1              S6.084,2.9,9.999,2.9 M9.999,1.9c-4.473,0-8.1,3.627-8.1,8.1c0,4.474,3.627,8.1,8.1,8.1c4.474,0,8.1-3.626,8.1-8.1              C18.099,5.527,14.473,1.9,9.999,1.9L9.999,1.9z"/>        </g>    </g></g><g> <path fill="#EC2227" d="M-94.626,18.434c-4.67,0-8.465-3.91-8.465-8.717c0-3.761,2.327-7.085,5.789-8.273      c0.49-0.168,1.029,0.093,1.197,0.586c0.169,0.493-0.094,1.029-0.586,1.198c-2.701,0.926-4.517,3.533-4.517,6.489        c0,3.766,2.954,6.831,6.582,6.831c2.845,0,5.354-1.883,6.248-4.686c0.159-0.495,0.685-0.771,1.184-0.612        c0.496,0.159,0.771,0.69,0.613,1.185C-87.725,16.021-90.958,18.434-94.626,18.434"/>   <path fill="#D8D8D8" d="M-94.668,10.836c-0.146,0-0.294-0.035-0.427-0.105c-0.315-0.161-0.515-0.485-0.515-0.839V4.651     c0-0.521,0.423-0.943,0.942-0.943c0.521,0,0.944,0.422,0.944,0.943v3.397l1.224-0.884c0.421-0.305,1.012-0.21,1.316,0.213       c0.306,0.421,0.21,1.012-0.212,1.314l-2.719,1.965C-94.279,10.775-94.473,10.836-94.668,10.836"/>  <path fill="#2CABE1" d="M-86.942,10.66c-0.52,0-0.941-0.421-0.941-0.943c0-3.767-2.953-6.833-6.581-6.833      c-0.52,0-0.943-0.422-0.943-0.942S-94.984,1-94.464,1C-89.796,1-86,4.911-86,9.717C-86,10.239-86.421,10.66-86.942,10.66"/></g><g></g><g></g><g></g><g></g><g></g><g></g></svg>

Which looks like this:
dot-ok

When I run svgo with all the plugins, it loses the blue half-cirlce:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><circle fill-rule="evenodd" clip-rule="evenodd" fill="#fff" cx="10" cy="10" r="9"/><circle fill-rule="evenodd" clip-rule="evenodd" fill="#45A8C6" cx="9.999" cy="10" r="8.1"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="9.998" y1="6.158" x2="9.998" y2="15.469"><stop offset="0" stop-color="#fff"/><stop offset="1"/></linearGradient><circle opacity=".2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#a)" cx="9.999" cy="10" r="8.1"/><path fill="#231F20" d="M9.999 2.9c3.915 0 7.1 3.185 7.1 7.1s-3.185 7.1-7.1 7.1c-3.915 0-7.1-3.185-7.1-7.1s3.185-7.1 7.1-7.1m0-1c-4.473 0-8.1 3.627-8.1 8.1 0 4.474 3.627 8.1 8.1 8.1 4.474 0 8.1-3.626 8.1-8.1 0-4.473-3.626-8.1-8.1-8.1z" opacity=".1"/><defs><rect id="b" y="1" width="19" height="9"/></defs><clipPath id="c"><use xlink:href="#b" overflow="visible"/></clipPath><circle clip-path="url(#c)" fill-rule="evenodd" clip-rule="evenodd" fill="#fff" cx="10" cy="10" r="9"/><circle fill-rule="evenodd" clip-rule="evenodd" fill="#E85200" cx="9.999" cy="10" r="8.1"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="9.998" y1="6.158" x2="9.998" y2="15.469"><stop offset="0" stop-color="#fff"/><stop offset="1"/></linearGradient><circle opacity=".2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#d)" cx="9.999" cy="10" r="8.1"/><path fill="#231F20" d="M9.999 2.9c3.915 0 7.1 3.185 7.1 7.1s-3.185 7.1-7.1 7.1c-3.915 0-7.1-3.185-7.1-7.1s3.185-7.1 7.1-7.1m0-1c-4.473 0-8.1 3.627-8.1 8.1 0 4.474 3.627 8.1 8.1 8.1 4.474 0 8.1-3.626 8.1-8.1 0-4.473-3.626-8.1-8.1-8.1z" opacity=".1"/><path fill="#EC2227" d="M-94.626 18.434c-4.67 0-8.465-3.91-8.465-8.717 0-3.761 2.327-7.085 5.789-8.273.49-.168 1.029.093 1.197.586.169.493-.094 1.029-.586 1.198-2.701.926-4.517 3.533-4.517 6.489 0 3.766 2.954 6.831 6.582 6.831 2.845 0 5.354-1.883 6.248-4.686.159-.495.685-.771 1.184-.612.496.159.771.69.613 1.185-1.144 3.586-4.377 5.999-8.045 5.999"/><path fill="#D8D8D8" d="M-94.668 10.836c-.146 0-.294-.035-.427-.105-.315-.161-.515-.485-.515-.839v-5.241c0-.521.423-.943.942-.943.521 0 .944.422.944.943v3.397l1.224-.884c.421-.305 1.012-.21 1.316.213.306.421.21 1.012-.212 1.314l-2.719 1.965c-.164.119-.358.18-.553.18"/><path fill="#2CABE1" d="M-86.942 10.66c-.52 0-.941-.421-.941-.943 0-3.767-2.953-6.833-6.581-6.833-.52 0-.943-.422-.943-.942s.423-.942.943-.942c4.668 0 8.464 3.911 8.464 8.717 0 .522-.421.943-.942.943"/></svg>

Which looks like this:
dot-bad

When I run it with --disable=removeNonInheritableGroupAttrs, it looks correct:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><circle fill-rule="evenodd" clip-rule="evenodd" fill="#fff" cx="10" cy="10" r="9"/><circle fill-rule="evenodd" clip-rule="evenodd" fill="#45A8C6" cx="9.999" cy="10" r="8.1"/><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="9.998" y1="6.158" x2="9.998" y2="15.469"><stop offset="0" stop-color="#fff"/><stop offset="1"/></linearGradient><circle opacity=".2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#a)" cx="9.999" cy="10" r="8.1"/><path fill="#231F20" d="M9.999 2.9c3.915 0 7.1 3.185 7.1 7.1s-3.185 7.1-7.1 7.1c-3.915 0-7.1-3.185-7.1-7.1s3.185-7.1 7.1-7.1m0-1c-4.473 0-8.1 3.627-8.1 8.1 0 4.474 3.627 8.1 8.1 8.1 4.474 0 8.1-3.626 8.1-8.1 0-4.473-3.626-8.1-8.1-8.1z" opacity=".1"/><defs><rect id="b" y="1" width="19" height="9"/></defs><clipPath id="c"><use xlink:href="#b" overflow="visible"/></clipPath><circle clip-path="url(#c)" fill-rule="evenodd" clip-rule="evenodd" fill="#fff" cx="10" cy="10" r="9"/><g clip-path="url(#c)"><circle fill-rule="evenodd" clip-rule="evenodd" fill="#E85200" cx="9.999" cy="10" r="8.1"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="9.998" y1="6.158" x2="9.998" y2="15.469"><stop offset="0" stop-color="#fff"/><stop offset="1"/></linearGradient><circle opacity=".2" fill-rule="evenodd" clip-rule="evenodd" fill="url(#d)" cx="9.999" cy="10" r="8.1"/><path fill="#231F20" d="M9.999 2.9c3.915 0 7.1 3.185 7.1 7.1s-3.185 7.1-7.1 7.1c-3.915 0-7.1-3.185-7.1-7.1s3.185-7.1 7.1-7.1m0-1c-4.473 0-8.1 3.627-8.1 8.1 0 4.474 3.627 8.1 8.1 8.1 4.474 0 8.1-3.626 8.1-8.1 0-4.473-3.626-8.1-8.1-8.1z" opacity=".1"/></g><path fill="#EC2227" d="M-94.626 18.434c-4.67 0-8.465-3.91-8.465-8.717 0-3.761 2.327-7.085 5.789-8.273.49-.168 1.029.093 1.197.586.169.493-.094 1.029-.586 1.198-2.701.926-4.517 3.533-4.517 6.489 0 3.766 2.954 6.831 6.582 6.831 2.845 0 5.354-1.883 6.248-4.686.159-.495.685-.771 1.184-.612.496.159.771.69.613 1.185-1.144 3.586-4.377 5.999-8.045 5.999"/><path fill="#D8D8D8" d="M-94.668 10.836c-.146 0-.294-.035-.427-.105-.315-.161-.515-.485-.515-.839v-5.241c0-.521.423-.943.942-.943.521 0 .944.422.944.943v3.397l1.224-.884c.421-.305 1.012-.21 1.316.213.306.421.21 1.012-.212 1.314l-2.719 1.965c-.164.119-.358.18-.553.18"/><path fill="#2CABE1" d="M-86.942 10.66c-.52 0-.941-.421-.941-.943 0-3.767-2.953-6.833-6.581-6.833-.52 0-.943-.422-.943-.942s.423-.942.943-.942c4.668 0 8.464 3.911 8.464 8.717 0 .522-.421.943-.942.943"/></svg>
@ghost ghost assigned deepsweet May 10, 2013
@davidlwarner
Copy link
Author

I should mention that this is with 0.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants