1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

plugins/removeNonInheritableGroupAttrs: more attrs groups to exclude (fix #118 fix #116)

This commit is contained in:
deepsweet
2013-05-30 12:08:05 +03:00
parent 0b5f72e586
commit a47ed63361
2 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,7 @@ exports.type = 'perItem';
exports.active = true;
var inheritableAttrs = require('./_collections').inheritableAttrs,
presentationAttrs = require('./_collections').attrsGroups.presentation,
attrsGroups = require('./_collections').attrsGroups,
excludedAttrs = ['display', 'opacity'];
/**
@ -22,9 +22,12 @@ exports.fn = function(item) {
item.eachAttr(function(attr) {
if (
presentationAttrs.indexOf(attr.name) !== -1 &&
excludedAttrs.indexOf(attr.name) === -1 &&
inheritableAttrs.indexOf(attr.name) === -1
~attrsGroups.presentation.indexOf(attr.name) &&
~attrsGroups.graphicalEvent.indexOf(attr.name) &&
~attrsGroups.core.indexOf(attr.name) &&
~attrsGroups.conditionalProcessing.indexOf(attr.name) &&
!~excludedAttrs.indexOf(attr.name) &&
!~inheritableAttrs.indexOf(attr.name)
) {
item.removeAttr(attr.name);
}