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

Fix removeViewBox to check for zero start coordinates. Fixes #832

This commit is contained in:
GreLI
2017-11-08 22:01:28 +03:00
parent efcb07ee65
commit f067ea996f
2 changed files with 11 additions and 0 deletions

View File

@ -35,6 +35,8 @@ exports.fn = function(item) {
var nums = item.attr('viewBox').value.split(/[ ,]+/g);
if (
nums[0] === '0' &&
nums[1] === '0' &&
item.attr('width').value.replace(/px$/, '') === nums[2] && // could use parseFloat too
item.attr('height').value.replace(/px$/, '') === nums[3]
) {

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="-25 -25 50 50">
test
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="-25 -25 50 50">
test
</svg>

After

Width:  |  Height:  |  Size: 214 B