项目原始demo,不改动
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

30 lines
509 B

  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. };