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:
@ -35,6 +35,8 @@ exports.fn = function(item) {
|
|||||||
var nums = item.attr('viewBox').value.split(/[ ,]+/g);
|
var nums = item.attr('viewBox').value.split(/[ ,]+/g);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
nums[0] === '0' &&
|
||||||
|
nums[1] === '0' &&
|
||||||
item.attr('width').value.replace(/px$/, '') === nums[2] && // could use parseFloat too
|
item.attr('width').value.replace(/px$/, '') === nums[2] && // could use parseFloat too
|
||||||
item.attr('height').value.replace(/px$/, '') === nums[3]
|
item.attr('height').value.replace(/px$/, '') === nums[3]
|
||||||
) {
|
) {
|
||||||
|
9
test/plugins/removeViewBox.04.svg
Normal file
9
test/plugins/removeViewBox.04.svg
Normal 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 |
Reference in New Issue
Block a user