remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

id on svg declaration are removed #125

Closed HugoGresse closed 7 years ago

HugoGresse commented 7 years ago

Using the following SVG

<svg version="1.1" id="search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 37 35.4"  class="injected-svg svg inject-svg" >
   <path class="st0" d="M14,28.1c-3.6,0-7-1.3-9.6-3.8c-2.7-2.6-4.3-6-4.5-9.8c-0.1-3.8,1.2-7.3,3.8-10.1C6.4,1.6,10.2,0,14.1,0  c3.6,0,7,1.3,9.6,3.8c5.7,5.3,6,14.2,0.7,19.9C21.7,26.5,17.9,28.1,14,28.1z M14.1,5.8c-2.3,0-4.5,0.9-6,2.6  c-1.5,1.6-2.3,3.7-2.2,5.9c0.1,2.2,1,4.2,2.6,5.7c1.5,1.4,3.5,2.2,5.6,2.2c2.3,0,4.5-0.9,6-2.6c3.1-3.3,2.9-8.5-0.4-11.6  C18.1,6.6,16.1,5.8,14.1,5.8z"></path>
   <polygon class="st0" points="36.7,31.2 37,35.4 32.7,35.5 19.7,23.3 23.7,19.1 "></polygon>
</svg>

The id="search-icon" is removed from the output.

This happen with the default option, if I use --nosvg the id is not removed.

remy commented 7 years ago

I appreciate this was months ago, but do you want to take a shot at a PR? The tests are very easy to setup (follow the contributing doc - just need two HTML files). Thanks so much!