ID Stripping
chriscoyier opened this issue · 6 comments
Because svgstore appends ID's, is that why it also strips ID's from other elements? So there isn't a conflict? That would make sense.
The issue for me is that when you name layers in Adobe Illustrator, it puts those as ID's on the elements. That's a kind of nice workflow. I updated my copy to append a class name of the ID as it's stripping it, so I still have something I can select by.
Not sure if that's something that is smart for everyone though.
It also might be a good note that the cleanup option, even when false, doesn't prevent the ID stripping.
The feature was introduced in a PR by @Frank3K maybe it isn't a good idea to do it. There are valid point to have an unreferenced ID in the SVG. I think the cleanup
option, if false
, should disable the ID stripping too.
In the current implementation, only unreferenced IDs are removed. Since all IDs id
are made unique by renaming them to svgstore
+md5
+id
I figured there is no use case for using them, e.g. by a selector.
I can change the behaviour such that they are only stripped when the options.cleanup
array contains id
. Would that solve the problem? Can you think of a better solution?
I think we should change the current behaviour!
OK, good. How should it be changed then?
Do you agree with my proposal? If so, I think I can work out a PR that does that.
Exactly just default to not clean the ID only if it is listed in the cleanup array.