Skip to content

Commit c1d5f0f

Browse files
committed
Keep empty <g> when filter attributes is specified
1 parent 776ec1e commit c1d5f0f

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

plugins/removeEmptyContainers.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ var container = require('./_collections').elemsGroups.container;
2525
* @author Kir Belevich
2626
*/
2727
exports.fn = function(item) {
28-
29-
return !(item.isElem(container) && !item.isElem('svg') && item.isEmpty() &&
30-
(!item.isElem('pattern') || !item.hasAttrLocal('href')));
31-
28+
return (
29+
item.isElem(container) === false ||
30+
item.isEmpty() === false ||
31+
item.isElem('svg') ||
32+
(item.isElem('pattern') && item.hasAttrLocal('href')) ||
33+
// The 'g' may not have content, but the filter may cause a rectangle
34+
// to be created and filled with pattern.
35+
(item.isElem('g') && item.hasAttr('filter'))
36+
);
3237
};
+23
Loading

0 commit comments

Comments
 (0)