1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

Fix viewBox value parsing

Fix #1024
This commit is contained in:
GreLI
2018-09-15 18:52:35 +03:00
parent 3c82fd7287
commit f3bcbcc6a6
2 changed files with 11 additions and 2 deletions

View File

@ -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