mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
Remove hasAttr and hasAttrLocal usages (#1447)
In most cases simple check for null is enough.
This commit is contained in:
@ -18,8 +18,10 @@ exports.description = 'removes raster images (disabled by default)';
|
||||
*/
|
||||
exports.fn = function (item) {
|
||||
if (
|
||||
item.isElem('image') &&
|
||||
item.hasAttrLocal('href', /(\.|image\/)(jpg|png|gif)/)
|
||||
item.type === 'element' &&
|
||||
item.name === 'image' &&
|
||||
item.attributes['xlink:href'] != null &&
|
||||
/(\.|image\/)(jpg|png|gif)/.test(item.attributes['xlink:href'])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user