mirror of
https://github.com/svg/svgo.git
synced 2025-07-31 07:44:22 +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;
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user