diff --git a/plugins/cleanupNumericValues.js b/plugins/cleanupNumericValues.js index f7c8a1ee..e37a0534 100644 --- a/plugins/cleanupNumericValues.js +++ b/plugins/cleanupNumericValues.js @@ -40,7 +40,7 @@ exports.fn = function(item, params) { var floatPrecision = params.floatPrecision; if (item.hasAttr('viewBox')) { - var nums = item.attr('viewBox').value.split(/[ ,]/g); + var nums = item.attr('viewBox').value.split(/\s,?\s*|,\s*/g); item.attr('viewBox').value = nums.map(function(value) { var num = +value; return isNaN(num) ? value : +num.toFixed(floatPrecision); @@ -50,7 +50,7 @@ exports.fn = function(item, params) { item.eachAttr(function(attr) { // The `version` attribute is a text string and cannot be rounded if (attr.name === 'version') { return } - + var match = attr.value.match(regNumericValues); // if attribute value matches regNumericValues diff --git a/test/plugins/cleanupNumericValues.02.svg b/test/plugins/cleanupNumericValues.02.svg new file mode 100644 index 00000000..fbacfbfb --- /dev/null +++ b/test/plugins/cleanupNumericValues.02.svg @@ -0,0 +1,9 @@ + + + + +@@@ + + + +