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.

27 lines
591 B

4 years ago
  1. 'use strict';
  2. exports.type = 'perItem';
  3. exports.active = false;
  4. exports.description = 'removes xmlns attribute (for inline svg, disabled by default)';
  5. /**
  6. * Remove the xmlns attribute when present.
  7. *
  8. * @example
  9. * <svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg">
  10. *
  11. * <svg viewBox="0 0 100 50">
  12. *
  13. * @param {Object} item current iteration item
  14. * @return {Boolean} if true, xmlns will be filtered out
  15. *
  16. * @author Ricardo Tomasi
  17. */
  18. exports.fn = function(item) {
  19. if (item.isElem('svg') && item.hasAttr('xmlns')) {
  20. item.removeAttr('xmlns');
  21. }
  22. };