mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
Replace removeAttr with delete operator (#1432)
delete operator is more explicit and not much harder to use.
This commit is contained in:
@ -60,9 +60,15 @@ exports.description =
|
||||
exports.fn = function (item, params) {
|
||||
var selectors = Array.isArray(params.selectors) ? params.selectors : [params];
|
||||
|
||||
selectors.map(function (i) {
|
||||
if (item.matches(i.selector)) {
|
||||
item.removeAttr(i.attributes);
|
||||
selectors.map(({ selector, attributes }) => {
|
||||
if (item.matches(selector)) {
|
||||
if (Array.isArray(attributes)) {
|
||||
for (const name of attributes) {
|
||||
delete item.attributes[name];
|
||||
}
|
||||
} else {
|
||||
delete item.attributes[attributes];
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user