source: trip-planner-front/node_modules/svgo/plugins/removeEmptyAttrs.js@ 76712b2

Last change on this file since 76712b2 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 777 bytes
Line 
1'use strict';
2
3const { attrsGroups } = require('./_collections.js');
4
5exports.type = 'visitor';
6exports.name = 'removeEmptyAttrs';
7exports.active = true;
8exports.description = 'removes empty attributes';
9
10/**
11 * Remove attributes with empty values.
12 *
13 * @author Kir Belevich
14 *
15 * @type {import('../lib/types').Plugin<void>}
16 */
17exports.fn = () => {
18 return {
19 element: {
20 enter: (node) => {
21 for (const [name, value] of Object.entries(node.attributes)) {
22 if (
23 value === '' &&
24 // empty conditional processing attributes prevents elements from rendering
25 attrsGroups.conditionalProcessing.includes(name) === false
26 ) {
27 delete node.attributes[name];
28 }
29 }
30 },
31 },
32 };
33};
Note: See TracBrowser for help on using the repository browser.