From f067ea996fe381a395effbf5e9526e2cedf39558 Mon Sep 17 00:00:00 2001 From: GreLI Date: Wed, 8 Nov 2017 22:01:28 +0300 Subject: [PATCH] Fix removeViewBox to check for zero start coordinates. Fixes #832 --- plugins/removeViewBox.js | 2 ++ test/plugins/removeViewBox.04.svg | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/plugins/removeViewBox.04.svg diff --git a/plugins/removeViewBox.js b/plugins/removeViewBox.js index 509d1195..2fbcba4f 100644 --- a/plugins/removeViewBox.js +++ b/plugins/removeViewBox.js @@ -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] ) { diff --git a/test/plugins/removeViewBox.04.svg b/test/plugins/removeViewBox.04.svg new file mode 100644 index 00000000..503e93b6 --- /dev/null +++ b/test/plugins/removeViewBox.04.svg @@ -0,0 +1,9 @@ + + test + + +@@@ + + + test +