1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-28 09:22:00 +03:00

plugins/removeRasterImages: remove raster images references in <image> (disabled by default) (close #98)

This commit is contained in:
deepsweet
2013-02-13 17:22:15 +02:00
parent 0ee129b0a2
commit 7ddc8ebbc0
6 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,23 @@
'use strict';
/**
* Remove raster images references in <image>.
*
* @see https://bugs.webkit.org/show_bug.cgi?id=63548
*
* @param {Object} item current iteration item
* @return {Boolean} if false, item will be filtered out
*
* @author Kir Belevich
*/
exports.removeRasterImages = function(item) {
if (
item.isElem('image') &&
item.hasAttr('xlink:href') &&
/(\.|image\/)(jpg|png)/.test(item.attr('xlink:href').value)
) {
return false;
}
};