UNPKG

767 BJavaScriptView Raw
1'use strict';
2
3exports.type = 'perItem';
4
5exports.active = true;
6
7exports.params = {
8 removeAny: true
9};
10
11exports.description = 'removes <desc>';
12
13var 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 */
27exports.fn = function(item, params) {
28
29 return !item.isElem('desc') || !(params.removeAny || item.isEmpty() ||
30 standardDescs.test(item.content[0].text));
31
32};