Skip to content

Commit

Permalink
Remove incorrect <path> elems, not just empty
Browse files Browse the repository at this point in the history
  • Loading branch information
GreLI committed Mar 22, 2015
1 parent 15e303b commit 5561372
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/removeHiddenElems.js
Expand Up @@ -21,6 +21,8 @@ exports.params = {
polygonEmptyPoints: true
};

var regValidPath = /m.*[lhvcsqta]/i;

/**
* Remove hidden elements with disabled rendering:
* - display="none"
Expand Down Expand Up @@ -184,7 +186,7 @@ exports.fn = function(item, params) {
if (
params.pathEmptyD &&
item.isElem('path') &&
!item.hasAttr('d')
(!item.hasAttr('d') || !regValidPath.test(item.attr('d')))
) return false;

// Polyline with empty points
Expand Down
1 change: 1 addition & 0 deletions test/plugins/removeHiddenElems.08.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 5561372

Please sign in to comment.