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.

32 lines
690 B

4 years ago
  1. 'use strict';
  2. exports.type = 'perItemReverse';
  3. exports.active = true;
  4. exports.description = 'removes empty container elements';
  5. var container = require('./_collections').elemsGroups.container;
  6. /**
  7. * Remove empty containers.
  8. *
  9. * @see http://www.w3.org/TR/SVG/intro.html#TermContainerElement
  10. *
  11. * @example
  12. * <defs/>
  13. *
  14. * @example
  15. * <g><marker><a/></marker></g>
  16. *
  17. * @param {Object} item current iteration item
  18. * @return {Boolean} if false, item will be filtered out
  19. *
  20. * @author Kir Belevich
  21. */
  22. exports.fn = function(item) {
  23. return !(item.isElem(container) && !item.isElem('svg') && item.isEmpty() &&
  24. (!item.isElem('pattern') || !item.hasAttrLocal('href')));
  25. };