From 5e5cb1aecc5a0c355d8987b50a865e2366f02b14 Mon Sep 17 00:00:00 2001 From: deepsweet Date: Fri, 18 Jan 2013 15:35:20 +0200 Subject: [PATCH] plugins/removeViewBox doesn't catch floating-point numbers (fix #88) --- plugins/removeViewBox.js | 4 ++-- test/plugins/removeViewBox.01.orig.svg | 2 +- test/plugins/removeViewBox.01.should.svg | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/removeViewBox.js b/plugins/removeViewBox.js index 99a3c285..0a0a0b14 100644 --- a/plugins/removeViewBox.js +++ b/plugins/removeViewBox.js @@ -1,6 +1,6 @@ 'use strict'; -var regViewBox = /^0\s0\s(\d+)\s(\d+)$/, +var regViewBox = /^0\s0\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)$/, viewBoxElems = ['svg', 'pattern']; /** @@ -32,7 +32,7 @@ exports.removeViewBox = function(item) { if (match) { if ( item.attr('width').value === match[1] && - item.attr('height').value === match[2] + item.attr('height').value === match[3] ) { item.removeAttr('viewBox'); } diff --git a/test/plugins/removeViewBox.01.orig.svg b/test/plugins/removeViewBox.01.orig.svg index 72937f2b..f38da92b 100644 --- a/test/plugins/removeViewBox.01.orig.svg +++ b/test/plugins/removeViewBox.01.orig.svg @@ -1,3 +1,3 @@ - + test diff --git a/test/plugins/removeViewBox.01.should.svg b/test/plugins/removeViewBox.01.should.svg index f0c6c5a5..b3634ff7 100644 --- a/test/plugins/removeViewBox.01.should.svg +++ b/test/plugins/removeViewBox.01.should.svg @@ -1,3 +1,3 @@ - + test