1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

JSHint :-|

This commit is contained in:
deepsweet
2012-10-12 22:36:12 +03:00
parent b83238acf1
commit 43d716296a
6 changed files with 12 additions and 14 deletions

View File

@ -179,7 +179,7 @@ function printPhantomTestInfo(file1, file2, width, height) {
if (code === 1) {
answer = 'OK';
} else if (code === 2) {
answer = 'Oops, files are not visually identical!\n\nIf you do not see any visual differences with your eyes then \ALL IS OK and there are only very minor floating point numbers rounding errors in some browsers.\nBut if you see significant errors then things are bad :), please create an issue at https://github.com/svg/svgo/issues';
answer = 'Oops, files are not visually identical!\n\nIf you do not see any visual differences with your eyes then ALL IS OK and there are only very minor floating point numbers rounding errors in some browsers.\nBut if you see significant errors then things are bad :), please create an issue at https://github.com/svg/svgo/issues';
} else if (code === 3) {
answer = 'Error while rendering SVG\nPlease create an issue at https://github.com/svg/svgo/issues';
} else if (code === 127) {

View File

@ -26,12 +26,12 @@ exports.cleanupEnableBackground = function(item, params) {
item.hasAttr('height')
) {
var match;
var match = item.attr('enable-background').value.match(regEnableBackground);
if (match = item.attr('enable-background').value.match(regEnableBackground)) {
if (match) {
if (
item.attr('width').value == match[1] &&
item.attr('height').value == match[2]
item.attr('width').value === match[1] &&
item.attr('height').value === match[2]
) {
if (item.isElem('svg')) {
item.removeAttr('enable-background');

View File

@ -1,5 +1,3 @@
var regViewBox = /^0\s0\s(\d+)\s(\d+)$/;
/**
* Remove some useless svg element attributes.
*

View File

@ -16,8 +16,8 @@ var collections = require('./_collections'),
* @author Jed Schmidt
*/
function rgb2hex(rgb) {
return "#" + ((256 + rgb[0] << 8 | rgb[1]) << 8 | rgb[2]).toString(16).slice(1);
};
return '#' + ((256 + rgb[0] << 8 | rgb[1]) << 8 | rgb[2]).toString(16).slice(1);
}
/**
* Convert different colors formats in element attributes to hex.

View File

@ -18,7 +18,7 @@ exports.removeDefaultPx = function(item, params) {
if (item.isElem() && item.hasAttr()) {
item.eachAttr(function(attr) {
attr.value = attr.value.replace(regValPx, "$1");
attr.value = attr.value.replace(regValPx, '$1');
});
}

View File

@ -26,12 +26,12 @@ exports.removeViewBox = function(item, params) {
item.hasAttr('height')
) {
var match;
var match = item.attr('viewBox').value.match(regViewBox);
if (match = item.attr('viewBox').value.match(regViewBox)) {
if (match) {
if (
item.attr('width').value == match[1] &&
item.attr('height').value == match[2]
item.attr('width').value === match[1] &&
item.attr('height').value === match[2]
) {
item.removeAttr('viewBox');
}