mirror of
https://github.com/svg/svgo.git
synced 2025-08-09 02:22:08 +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:
@@ -121,12 +121,12 @@ exports.fn = function(data, params) {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var idKey;
|
||||||
for (var k in referencesIDs) {
|
for (var k in referencesIDs) {
|
||||||
if (IDs[k]) {
|
if (IDs[k]) {
|
||||||
|
idKey = k;
|
||||||
// replace referenced IDs with the minified ones
|
// replace referenced IDs with the minified ones
|
||||||
if (params.minify) {
|
if (params.minify) {
|
||||||
|
|
||||||
currentIDstring = getIDstring(currentID = generateID(currentID), params);
|
currentIDstring = getIDstring(currentID = generateID(currentID), params);
|
||||||
IDs[k].attr('id').value = currentIDstring;
|
IDs[k].attr('id').value = currentIDstring;
|
||||||
|
|
||||||
@@ -137,11 +137,11 @@ exports.fn = function(data, params) {
|
|||||||
.replace(k + '.', currentIDstring + '.');
|
.replace(k + '.', currentIDstring + '.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
idKey = idPrefix + k;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't remove referenced IDs
|
// don't remove referenced IDs
|
||||||
delete IDs[idPrefix + k];
|
delete IDs[idKey];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user