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

Filter corruption #118

Closed
oleggromov opened this issue May 20, 2013 · 2 comments
Closed

Filter corruption #118

oleggromov opened this issue May 20, 2013 · 2 comments
Assignees
Labels

Comments

@oleggromov
Copy link

Hi!
I've found SVGO removing the "id" attribute from elements and "filter" attribute from elements. I think this is tactless behavior.

@deepsweet
Copy link
Member

please provide a before/after example because SVGO should not remove these attrs for no reason.

@oleggromov
Copy link
Author

before.svg

<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 513 36">

<defs>
    <filter id="shadow" x="-30%" y="-30%" width="180%" height="180%">
      <feGaussianBlur in="SourceAlpha" stdDeviation="0.25" /> 
      <feOffset dx="1" dy="1" result="offsetblur"/> 
      <feComponentTransfer>
        <feFuncA type="linear" slope="0.4"/>
      </feComponentTransfer>
      <feMerge> 
        <feMergeNode/>
        <feMergeNode in="SourceGraphic"/> 
      </feMerge>
    </filter>
  </defs>

<g filter="url(#shadow)">
    <path fill="#da107e" d="M0.682,9.332C0.654,9.192,0.533,8.682,0.32,7.8C0.107,6.918,0,6.253,0,5.805
        c0-0.994,0.315-1.816,0.945-2.467c0.63-0.651,1.459-0.978,2.488-0.978c2.016,0,3.22,1.047,3.611,3.14l3.611,16.512h0.095
        l5.028-16.041c0.42-1.302,0.945-2.229,1.575-2.782c0.63-0.553,1.424-0.83,2.383-0.83c0.952,0,1.729,0.275,2.331,0.824
        c0.602,0.55,1.113,1.479,1.533,2.787l5.039,16.042h0.084l3.611-16.513c0.399-2.094,1.603-3.14,3.611-3.14
        c1.043,0,1.877,0.326,2.504,0.978c0.626,0.65,0.939,1.473,0.939,2.467c0,0.763-0.231,1.939-0.693,3.527
        c-0.224,0.902-0.567,2.303-1.029,4.198c-0.462,1.897-1.158,4.749-2.089,8.557c-0.931,3.807-1.512,6.189-1.743,7.148
        c-0.378,1.666-0.955,2.801-1.732,3.4c-0.777,0.602-1.76,0.904-2.95,0.904c-2.464,0-4.112-1.266-4.945-3.791L19.735,15.65H19.64
        l-4.419,14.099c-0.448,1.273-1.064,2.225-1.848,2.85c-0.784,0.627-1.833,0.941-3.149,0.941c-1.134,0-2.094-0.277-2.882-0.83
        c-0.787-0.553-1.359-1.596-1.716-3.129c-0.679-2.891-1.384-5.822-2.115-8.797c-0.731-2.975-1.393-5.626-1.984-7.958
        C0.936,10.495,0.626,9.33,0.598,9.33h0.084V9.332z"/>
</g>

<g>
    <path fill="#FFFFFF" d="M0.682,9.332C0.654,9.192,0.533,8.682,0.32,7.8C0.107,6.918,0,6.253,0,5.805
        c0-0.994,0.315-1.816,0.945-2.467c0.63-0.651,1.459-0.978,2.488-0.978c2.016,0,3.22,1.047,3.611,3.14l3.611,16.512h0.095
        l5.028-16.041c0.42-1.302,0.945-2.229,1.575-2.782c0.63-0.553,1.424-0.83,2.383-0.83c0.952,0,1.729,0.275,2.331,0.824
        c0.602,0.55,1.113,1.479,1.533,2.787l5.039,16.042h0.084l3.611-16.513c0.399-2.094,1.603-3.14,3.611-3.14
        c1.043,0,1.877,0.326,2.504,0.978c0.626,0.65,0.939,1.473,0.939,2.467c0,0.763-0.231,1.939-0.693,3.527
        c-0.224,0.902-0.567,2.303-1.029,4.198c-0.462,1.897-1.158,4.749-2.089,8.557c-0.931,3.807-1.512,6.189-1.743,7.148
        c-0.378,1.666-0.955,2.801-1.732,3.4c-0.777,0.602-1.76,0.904-2.95,0.904c-2.464,0-4.112-1.266-4.945-3.791L19.735,15.65H19.64
        l-4.419,14.099c-0.448,1.273-1.064,2.225-1.848,2.85c-0.784,0.627-1.833,0.941-3.149,0.941c-1.134,0-2.094-0.277-2.882-0.83
        c-0.787-0.553-1.359-1.596-1.716-3.129c-0.679-2.891-1.384-5.822-2.115-8.797c-0.731-2.975-1.393-5.626-1.984-7.958
        C0.936,10.495,0.626,9.33,0.598,9.33h0.084V9.332z"/>
</g>
</svg>

after.svg

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 36"><defs><filter x="-30%" y="-30%" width="180%" height="180%"><feGaussianBlur in="SourceAlpha" stdDeviation=".25"/><feOffset dx="1" dy="1"/><feComponentTransfer><feFuncA type="linear" slope=".4"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path fill="#da107e" d="M.682 9.332c-.028-.14-.149-.65-.362-1.532s-.32-1.547-.32-1.995c0-.994.315-1.816.945-2.467.63-.651 1.459-.978 2.488-.978 2.016 0 3.22 1.047 3.611 3.14l3.611 16.512h.095l5.028-16.041c.42-1.302.945-2.229 1.575-2.782.63-.553 1.424-.83 2.383-.83.952 0 1.729.275 2.331.824.602.55 1.113 1.479 1.533 2.787l5.039 16.042h.084l3.611-16.513c.399-2.094 1.603-3.14 3.611-3.14 1.043 0 1.877.326 2.504.978.626.65.939 1.473.939 2.467 0 .763-.231 1.939-.693 3.527-.224.902-.567 2.303-1.029 4.198-.462 1.897-1.158 4.749-2.089 8.557-.931 3.807-1.512 6.189-1.743 7.148-.378 1.666-.955 2.801-1.732 3.4-.777.602-1.76.904-2.95.904-2.464 0-4.112-1.266-4.945-3.791l-4.472-14.097h-.095l-4.419 14.099c-.448 1.273-1.064 2.225-1.848 2.85-.784.627-1.833.941-3.149.941-1.134 0-2.094-.277-2.882-.83-.787-.553-1.359-1.596-1.716-3.129-.679-2.891-1.384-5.822-2.115-8.797-.731-2.975-1.393-5.626-1.984-7.958-.591-2.331-.901-3.496-.929-3.496h.084v.002z"/><path fill="#fff" d="M.682 9.332c-.028-.14-.149-.65-.362-1.532s-.32-1.547-.32-1.995c0-.994.315-1.816.945-2.467.63-.651 1.459-.978 2.488-.978 2.016 0 3.22 1.047 3.611 3.14l3.611 16.512h.095l5.028-16.041c.42-1.302.945-2.229 1.575-2.782.63-.553 1.424-.83 2.383-.83.952 0 1.729.275 2.331.824.602.55 1.113 1.479 1.533 2.787l5.039 16.042h.084l3.611-16.513c.399-2.094 1.603-3.14 3.611-3.14 1.043 0 1.877.326 2.504.978.626.65.939 1.473.939 2.467 0 .763-.231 1.939-.693 3.527-.224.902-.567 2.303-1.029 4.198-.462 1.897-1.158 4.749-2.089 8.557-.931 3.807-1.512 6.189-1.743 7.148-.378 1.666-.955 2.801-1.732 3.4-.777.602-1.76.904-2.95.904-2.464 0-4.112-1.266-4.945-3.791l-4.472-14.097h-.095l-4.419 14.099c-.448 1.273-1.064 2.225-1.848 2.85-.784.627-1.833.941-3.149.941-1.134 0-2.094-.277-2.882-.83-.787-.553-1.359-1.596-1.716-3.129-.679-2.891-1.384-5.822-2.115-8.797-.731-2.975-1.393-5.626-1.984-7.958-.591-2.331-.901-3.496-.929-3.496h.084v.002z"/></svg>

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