mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
plugins/removeViewBox doesn't catch floating-point numbers (fix #88)
This commit is contained in:
@ -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');
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="50" viewBox="0 0 100 50">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100.5" height=".5" viewBox="0 0 100.5 .5">
|
||||
test
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 102 B After Width: | Height: | Size: 106 B |
@ -1,3 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="50">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100.5" height=".5">
|
||||
test
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 81 B After Width: | Height: | Size: 83 B |
Reference in New Issue
Block a user