You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
509 B

4 years ago
  1. 'use strict';
  2. exports.type = 'perItem';
  3. exports.active = true;
  4. exports.description = 'removes empty attributes';
  5. /**
  6. * Remove attributes with empty values.
  7. *
  8. * @param {Object} item current iteration item
  9. * @return {Boolean} if false, item will be filtered out
  10. *
  11. * @author Kir Belevich
  12. */
  13. exports.fn = function(item) {
  14. if (item.elem) {
  15. item.eachAttr(function(attr) {
  16. if (attr.value === '') {
  17. item.removeAttr(attr.name);
  18. }
  19. });
  20. }
  21. };