nav tabs on admin dashboard
This commit is contained in:
26
node_modules/svgo/plugins/removeUselessDefs.js
generated
vendored
26
node_modules/svgo/plugins/removeUselessDefs.js
generated
vendored
@@ -6,8 +6,7 @@ exports.active = true;
|
||||
|
||||
exports.description = 'removes elements in <defs> without id';
|
||||
|
||||
var nonRendering = require('./_collections').elemsGroups.nonRendering,
|
||||
defs;
|
||||
var nonRendering = require('./_collections').elemsGroups.nonRendering;
|
||||
|
||||
/**
|
||||
* Removes content of defs and properties that aren't rendered directly without ids.
|
||||
@@ -21,9 +20,10 @@ exports.fn = function(item) {
|
||||
|
||||
if (item.isElem('defs')) {
|
||||
|
||||
defs = item;
|
||||
item.content = (item.content || []).reduce(getUsefulItems, []);
|
||||
|
||||
if (item.content) {
|
||||
item.content = getUsefulItems(item, []);
|
||||
}
|
||||
|
||||
if (item.isEmpty()) return false;
|
||||
|
||||
} else if (item.isElem(nonRendering) && !item.hasAttr('id')) {
|
||||
@@ -34,18 +34,20 @@ exports.fn = function(item) {
|
||||
|
||||
};
|
||||
|
||||
function getUsefulItems(usefulItems, item) {
|
||||
function getUsefulItems(item, usefulItems) {
|
||||
|
||||
if (item.hasAttr('id') || item.isElem('style')) {
|
||||
item.content.forEach(function(child) {
|
||||
if (child.hasAttr('id') || child.isElem('style')) {
|
||||
|
||||
usefulItems.push(item);
|
||||
item.parentNode = defs;
|
||||
usefulItems.push(child);
|
||||
child.parentNode = item;
|
||||
|
||||
} else if (!item.isEmpty()) {
|
||||
} else if (!child.isEmpty()) {
|
||||
|
||||
item.content.reduce(getUsefulItems, usefulItems);
|
||||
child.content = getUsefulItems(child, usefulItems);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return usefulItems;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user