mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
plugins/moveElemsAttrsToGroup: fix bug with a wrong attrs intersecting
This commit is contained in:
@ -106,6 +106,8 @@ exports.intersectAttrs = function(a, b) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!Object.keys(c).length) return false;
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,22 +34,23 @@ exports.moveElemsAttrsToGroup = function(item, params) {
|
|||||||
if (!Object.keys(intersection).length) {
|
if (!Object.keys(intersection).length) {
|
||||||
intersection = g.attrs;
|
intersection = g.attrs;
|
||||||
} else {
|
} else {
|
||||||
intersection = intersectAttrs(intersection, g.attrs)
|
intersection = intersectAttrs(intersection, g.attrs);
|
||||||
|
|
||||||
|
if (!intersection) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (every && Object.keys(intersection).length) {
|
|
||||||
|
|
||||||
|
if (every) {
|
||||||
item.content.forEach(function(g) {
|
item.content.forEach(function(g) {
|
||||||
for (var name in intersection) {
|
for (var name in intersection) {
|
||||||
g.removeAttr(name);
|
g.removeAttr(name);
|
||||||
item.addAttr(intersection[name]);
|
item.addAttr(intersection[name]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user