Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/svgo/plugins/removeEmptyAttrs.js

    r59329aa re29cc2e  
    33const { attrsGroups } = require('./_collections.js');
    44
     5exports.type = 'visitor';
    56exports.name = 'removeEmptyAttrs';
    6 
    7 exports.type = 'perItem';
    8 
    97exports.active = true;
    10 
    118exports.description = 'removes empty attributes';
    129
     
    1411 * Remove attributes with empty values.
    1512 *
    16  * @param {Object} item current iteration item
    17  * @return {Boolean} if false, item will be filtered out
     13 * @author Kir Belevich
    1814 *
    19  * @author Kir Belevich
     15 * @type {import('../lib/types').Plugin<void>}
    2016 */
    21 exports.fn = function (item) {
    22   if (item.type === 'element') {
    23     for (const [name, value] of Object.entries(item.attributes)) {
    24       if (
    25         value === '' &&
    26         // empty conditional processing attributes prevents elements from rendering
    27         attrsGroups.conditionalProcessing.includes(name) === false
    28       ) {
    29         delete item.attributes[name];
    30       }
    31     }
    32   }
     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  };
    3333};
Note: See TracChangeset for help on using the changeset viewer.