Galerie und tage
This commit is contained in:
23
node_modules/svgo/plugins/removeViewBox.js
generated
vendored
23
node_modules/svgo/plugins/removeViewBox.js
generated
vendored
@@ -2,11 +2,12 @@
|
||||
|
||||
exports.type = 'perItem';
|
||||
|
||||
exports.active = true;
|
||||
exports.active = false;
|
||||
|
||||
exports.description = 'removes viewBox attribute when possible';
|
||||
exports.description = 'removes viewBox attribute when possible (disabled by default)';
|
||||
|
||||
var viewBoxElems = ['svg', 'pattern', 'symbol'];
|
||||
var regViewBox = /^0\s0\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)$/,
|
||||
viewBoxElems = ['svg', 'pattern'];
|
||||
|
||||
/**
|
||||
* Remove viewBox attr which coincides with a width/height box.
|
||||
@@ -32,15 +33,15 @@ exports.fn = function(item) {
|
||||
item.hasAttr('height')
|
||||
) {
|
||||
|
||||
var nums = item.attr('viewBox').value.split(/[ ,]+/g);
|
||||
var match = item.attr('viewBox').value.match(regViewBox);
|
||||
|
||||
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]
|
||||
) {
|
||||
item.removeAttr('viewBox');
|
||||
if (match) {
|
||||
if (
|
||||
item.attr('width').value === match[1] &&
|
||||
item.attr('height').value === match[3]
|
||||
) {
|
||||
item.removeAttr('viewBox');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user