1 | ;
|
2 |
|
3 | exports.type = 'perItem';
|
4 |
|
5 | exports.active = true;
|
6 |
|
7 | exports.params = {
|
8 | removeAny: true
|
9 | };
|
10 |
|
11 | exports.description = 'removes <desc>';
|
12 |
|
13 | var standardDescs = /^(Created with|Created using)/;
|
14 |
|
15 | /**
|
16 | * Removes <desc>.
|
17 | * Removes only standard editors content or empty elements 'cause it can be used for accessibility.
|
18 | * Enable parameter 'removeAny' to remove any description.
|
19 | *
|
20 | * https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
|
21 | *
|
22 | * @param {Object} item current iteration item
|
23 | * @return {Boolean} if false, item will be filtered out
|
24 | *
|
25 | * @author Daniel Wabyick
|
26 | */
|
27 | exports.fn = function(item, params) {
|
28 |
|
29 | return !item.isElem('desc') || !(params.removeAny || item.isEmpty() ||
|
30 | standardDescs.test(item.content[0].text));
|
31 |
|
32 | };
|