Skip to content

Commit

Permalink
Merge 9508f6b into 1152257
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpavlovich committed Nov 9, 2019
2 parents 1152257 + 9508f6b commit df57eee
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/cleanupIDs.js
Expand Up @@ -63,11 +63,13 @@ exports.fn = function(data, params) {
hasStyleOrScript = true;
continue;
}

// Don't remove IDs if the whole SVG consists only of defs.
if (item.isElem('defs') && item.parentNode.isElem('svg')) {
if (item.isElem('svg')) {
var hasDefsOnly = true;
for (var j = i + 1; j < items.content.length; j++) {
if (items.content[j].isElem()) {

for (var j = 0; j < item.content.length; j++) {
if (!item.content[j].isElem('defs')) {
hasDefsOnly = false;
break;
}
Expand Down
41 changes: 41 additions & 0 deletions test/plugins/cleanupIDs.20.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit df57eee

Please sign in to comment.