mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
plugins/cleanupEnableBackground: important fixes
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
var regEnableBackground = /^new\s0\s0\s(\d+)\s(\d+)$/,
|
||||
container = require('./_collections').elems.container;
|
||||
elems = ['svg', 'mask', 'pattern'];
|
||||
|
||||
/**
|
||||
* Remove or cleanup enable-background attr which coincides with a width/height box.
|
||||
@ -20,15 +20,16 @@ var regEnableBackground = /^new\s0\s0\s(\d+)\s(\d+)$/,
|
||||
exports.cleanupEnableBackground = function(item, params) {
|
||||
|
||||
if (
|
||||
item.isElem(container) &&
|
||||
item.isElem(elems) &&
|
||||
item.hasAttr('enable-background') &&
|
||||
item.hasAttr('width') &&
|
||||
item.hasAttr('height')
|
||||
) {
|
||||
|
||||
var match;
|
||||
|
||||
if (match = item.attr('enable-background').value.match(regEnableBackground)) {
|
||||
if (
|
||||
// TODO: not all containers have width/height attrs
|
||||
item.attr('width').value == match[1] &&
|
||||
item.attr('height').value == match[2]
|
||||
) {
|
||||
|
Reference in New Issue
Block a user