UNPKG

945 BJavaScriptView Raw
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};