1
0
mirror of https://github.com/svg/svgo.git synced 2025-08-01 18:46:52 +03:00

When minify:false cleanupIds deletes too many ids

when running cleanupIds with minify:false option it does not save a reference to all ids and removes ids that shouldn't be removed.
This fix adds a var that keeps a ref to the original id even if minify is not defined
This commit is contained in:
Tom Bigelajzen
2016-08-19 18:38:23 +03:00
committed by GitHub
parent 7302d4d8cc
commit 4865892f6e

View File

@ -121,12 +121,12 @@ exports.fn = function(data, params) {
return data;
}
var idKey;
for (var k in referencesIDs) {
if (IDs[k]) {
idKey = k;
// replace referenced IDs with the minified ones
if (params.minify) {
currentIDstring = getIDstring(currentID = generateID(currentID), params);
IDs[k].attr('id').value = currentIDstring;
@ -137,11 +137,11 @@ exports.fn = function(data, params) {
.replace(k + '.', currentIDstring + '.');
});
idKey = idPrefix + k;
}
// don't remove referenced IDs
delete IDs[idPrefix + k];
delete IDs[idKey];
}
}