source: frontend/node_modules/svgo/plugins/removeNonInheritableGroupAttrs.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 945 bytes
Line 
1'use strict';
2
3exports.type = 'perItem';
4
5exports.active = true;
6
7exports.description = 'removes non-inheritable group’s presentational attributes';
8
9var inheritableAttrs = require('./_collections').inheritableAttrs,
10 attrsGroups = require('./_collections').attrsGroups,
11 applyGroups = require('./_collections').presentationNonInheritableGroupAttrs;
12
13/**
14 * Remove non-inheritable group's "presentation" attributes.
15 *
16 * @param {Object} item current iteration item
17 * @return {Boolean} if false, item will be filtered out
18 *
19 * @author Kir Belevich
20 */
21exports.fn = function(item) {
22
23 if (item.isElem('g')) {
24
25 item.eachAttr(function(attr) {
26 if (
27 ~attrsGroups.presentation.indexOf(attr.name) &&
28 !~inheritableAttrs.indexOf(attr.name) &&
29 !~applyGroups.indexOf(attr.name)
30 ) {
31 item.removeAttr(attr.name);
32 }
33 });
34
35 }
36
37};
Note: See TracBrowser for help on using the repository browser.