source: trip-planner-front/node_modules/svgo/plugins/removeEmptyAttrs.js@ 571e0df

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

primeNG components

  • Property mode set to 100644
File size: 777 bytes
RevLine 
[6a3a178]1'use strict';
2
3const { attrsGroups } = require('./_collections.js');
4
[e29cc2e]5exports.type = 'visitor';
[6a3a178]6exports.name = 'removeEmptyAttrs';
7exports.active = true;
8exports.description = 'removes empty attributes';
9
10/**
11 * Remove attributes with empty values.
12 *
13 * @author Kir Belevich
[e29cc2e]14 *
15 * @type {import('../lib/types').Plugin<void>}
[6a3a178]16 */
[e29cc2e]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 };
[6a3a178]33};
Note: See TracBrowser for help on using the repository browser.