Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73c5b3383e | ||
|
|
5f09fb3bde | ||
|
|
0610fd6fbb | ||
|
|
85c685a5ca | ||
|
|
2977506cb8 | ||
|
|
538d734a5b | ||
|
|
e680f429eb | ||
|
|
c308850eb3 | ||
|
|
8e941233a0 | ||
|
|
22a8a206ab | ||
|
|
773249ca4f | ||
|
|
599d02ea0e | ||
|
|
675316c9b7 | ||
|
|
c22fd8b132 | ||
|
|
c4b008f910 | ||
|
|
0cde5a3607 | ||
|
|
6180b9f86c | ||
|
|
daae7d8523 | ||
|
|
540e5b5ac0 | ||
|
|
4b671001e0 | ||
|
|
1ae4bed339 | ||
|
|
04e734bd5a | ||
|
|
a0e71ef444 | ||
|
|
05d8da36d8 | ||
|
|
5cae61b896 | ||
|
|
a319e84831 | ||
|
|
d38781400e | ||
|
|
cbcc6647f2 | ||
|
|
d2a217319d | ||
|
|
280b564ab3 | ||
|
|
0e14b5bd04 | ||
|
|
90ded3e1cb | ||
|
|
163eef58c2 | ||
|
|
201bf75bf7 | ||
|
|
ac37ebb4e2 | ||
|
|
16c3abf3f2 | ||
|
|
d1681c3d88 | ||
|
|
97099e9f65 | ||
|
|
4e8cb19f55 | ||
|
|
47eab96a67 | ||
|
|
ec7cba8f49 | ||
|
|
e0d497796a | ||
|
|
c5bc02d45d | ||
|
|
e2b713282c | ||
|
|
05c883fa3e | ||
|
|
e5d9680b23 | ||
|
|
4a40483348 | ||
|
|
5f12d1ce0e | ||
|
|
050b2303f0 | ||
|
|
82294983b0 | ||
|
|
8558ea29df | ||
|
|
9211074b32 | ||
|
|
2da4371847 | ||
|
|
791bf9fc8d | ||
|
|
e4b324d209 | ||
|
|
3b0bd172ba |
+3
-1
@@ -4,4 +4,6 @@ package-lock.json
|
||||
tmp
|
||||
coverage
|
||||
package-lock.json
|
||||
har.json
|
||||
yarn.lock
|
||||
har.json
|
||||
.idea/
|
||||
+6
-2
@@ -15,7 +15,6 @@ var cli = meow({
|
||||
'Options:',
|
||||
' --device Simulates a device. Choose between phone (default), tablet, desktop and desktop-hd.',
|
||||
' --screenshot Will take a screenshot and use this value as the output path. It needs to end with ".png".',
|
||||
//' --wait-for-selector Once the page is loaded, Phantomas will wait until the given CSS selector matches some elements.',
|
||||
' --proxy Sets an HTTP proxy to pass through. Syntax is "host:port".',
|
||||
' --cookie Adds a cookie on the main domain.',
|
||||
' --auth-user Basic HTTP authentication username.',
|
||||
@@ -24,6 +23,8 @@ var cli = meow({
|
||||
' --allow-domain Only allow requests to given (comma-separated) domains.',
|
||||
' --no-externals Block all domains except the main one.',
|
||||
' --reporter The output format: "json" or "xml". Default is "json".',
|
||||
' --local-storage Ability to set a local storage, key-value pairs (e.g. "bar=foo;domain=url")',
|
||||
' --session-storage Ability to set a session storage, key-value pairs (e.g. "bar=foo;domain=url")',
|
||||
''
|
||||
].join('\n'),
|
||||
pkg: require('../package.json')
|
||||
@@ -75,6 +76,10 @@ options.blockDomain = cli.flags.blockDomain || null;
|
||||
options.allowDomain = cli.flags.allowDomain || null;
|
||||
options.noExternals = cli.flags.noExternals || null;
|
||||
|
||||
// Storage injection
|
||||
options.localStorage = cli.flags.localStorage;
|
||||
options.sessionStorage = cli.flags.sessionStorage;
|
||||
|
||||
// Output format
|
||||
if (cli.flags.reporter && cli.flags.reporter !== 'json' && cli.flags.reporter !== 'xml') {
|
||||
console.error('Incorrect parameters: reporter has to be "json" or "xml"');
|
||||
@@ -98,7 +103,6 @@ if (cli.flags.reporter && cli.flags.reporter !== 'json' && cli.flags.reporter !=
|
||||
|
||||
// Remove some heavy parts of the results object
|
||||
delete data.toolsResults;
|
||||
delete data.javascriptExecutionTree;
|
||||
|
||||
var xmlOutput = serializer.render(data);
|
||||
|
||||
|
||||
+44
-10
@@ -1,13 +1,13 @@
|
||||
var Q = require('q');
|
||||
var debug = require('debug')('ylt:index');
|
||||
var Q = require('q');
|
||||
|
||||
var Runner = require('./runner');
|
||||
var Runner = require('./runner');
|
||||
var ScreenshotHandler = require('./screenshotHandler');
|
||||
|
||||
var packageJson = require('../package.json');
|
||||
|
||||
|
||||
var yellowLabTools = function(url, options) {
|
||||
'use strict';
|
||||
|
||||
var deferred = Q.defer();
|
||||
|
||||
if (!url) {
|
||||
@@ -27,15 +27,49 @@ var yellowLabTools = function(url, options) {
|
||||
|
||||
var runner = new Runner(params)
|
||||
|
||||
.progress(deferred.notify)
|
||||
.progress(deferred.notify)
|
||||
|
||||
.then(function(data) {
|
||||
.then(function(data) {
|
||||
|
||||
// If a screenshot saveFunction was provided in the options
|
||||
if (options && typeof options.saveScreenshotFn === 'function') {
|
||||
debug('Now optimizing screenshot...');
|
||||
|
||||
// TODO: temporarily set all screenshot sizes to 600px, until we find a solution
|
||||
ScreenshotHandler.findAndOptimizeScreenshot(data.params.options.screenshot, 600)
|
||||
|
||||
.then(function(screenshotBuffer) {
|
||||
debug('Screenshot optimized, now saving...');
|
||||
|
||||
return options.saveScreenshotFn('screenshot.jpg', screenshotBuffer);
|
||||
})
|
||||
|
||||
.then(function(response) {
|
||||
debug('Screenshot saved');
|
||||
debug(response);
|
||||
|
||||
// Remove uneeded temp screenshot path
|
||||
delete data.params.options.screenshot;
|
||||
})
|
||||
|
||||
.catch(function(err) {
|
||||
// It's ok if we can't save the screenshot
|
||||
debug('Screenshot could not be saved');
|
||||
debug(err);
|
||||
})
|
||||
|
||||
.finally(function() {
|
||||
deferred.resolve(data);
|
||||
});
|
||||
|
||||
} else {
|
||||
deferred.resolve(data);
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
.fail(function(err) {
|
||||
deferred.reject(err);
|
||||
});
|
||||
.catch(function(err) {
|
||||
deferred.reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
|
||||
+89
-15
@@ -54,7 +54,7 @@ var policies = {
|
||||
"isBadThreshold": 2000,
|
||||
"isAbnormalThreshold": 4000,
|
||||
"hasOffenders": false,
|
||||
"unit": 'ms'
|
||||
"unit": "ms"
|
||||
},
|
||||
"DOMaccesses": {
|
||||
"tool": "domAccessAgregator",
|
||||
@@ -734,22 +734,96 @@ var policies = {
|
||||
"isBadThreshold": 3145728,
|
||||
"isAbnormalThreshold": 5242880,
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
"unit": "bytes"
|
||||
},
|
||||
"imageOptimization": {
|
||||
"tool": "redownload",
|
||||
"imagesNotOptimized": {
|
||||
"tool": "phantomas",
|
||||
"label": "Image optimization",
|
||||
"message": "<p>This metric measures the number of bytes that could be saved by optimizing images.</p><p>Image optimization is generally one of the easiest way to reduce a page weight, and as a result, the page load time. Don't use Photoshop or other image editing tools, they're not very good for optimization. Use specialized tools such as <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a>.</p><p>The tools in use in YellowLabTools are not set to their maximum optimization power (JPEG quality 85), so you might be able to compress even more!</p>",
|
||||
"isOkThreshold": 20480,
|
||||
"message": "<p>This metric measures the number of bytes that could be saved by optimizing images.</p><p>Image optimization is generally one of the easiest way to reduce a page weight, and as a result, the page load time. Don't use Photoshop or other image editing tools, they're not very good for optimization. Use specialized tools such as <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a>.</p><p>The tools in use in YellowLabTools are not set to their maximum optimization power, so you might be able to compress even more!</p>",
|
||||
"isOkThreshold": 2048,
|
||||
"isBadThreshold": 204800,
|
||||
"isAbnormalThreshold": 307200,
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
"unit": "bytes",
|
||||
"valueTransformFn": function(offenders) {
|
||||
let totalGain = 0;
|
||||
offenders.forEach((offender) => {
|
||||
offender.gain = offender.fileSize - offender.newFileSize;
|
||||
totalGain += offender.gain;
|
||||
});
|
||||
return totalGain;
|
||||
},
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return offenders;
|
||||
}
|
||||
},
|
||||
"imagesTooLarge": {
|
||||
"tool": "redownload",
|
||||
"imagesOldFormat": {
|
||||
"tool": "phantomas",
|
||||
"label": "Old image formats",
|
||||
"message": "<p>This metric goes further than \"Image optimization\". Measures the number of bytes that could be saved by converting images to newer and more efficient formats. The best image format is generally AVIF and the second best is WebP.</p><p>Be careful, you need to provide fallback images for old browsers and search engine bots.</p>",
|
||||
"isOkThreshold": 2048,
|
||||
"isBadThreshold": 512000,
|
||||
"isAbnormalThreshold": 819200,
|
||||
"hasOffenders": true,
|
||||
"unit": "bytes",
|
||||
"valueTransformFn": function(offenders) {
|
||||
let totalGain = 0;
|
||||
offenders.forEach((offender) => {
|
||||
offender.gain = offender.fileSize - offender.newFileSize;
|
||||
totalGain += offender.gain;
|
||||
});
|
||||
return totalGain;
|
||||
},
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return offenders;
|
||||
}
|
||||
},
|
||||
"imagesScaledDown": {
|
||||
"tool": "phantomas",
|
||||
"label": "Oversized images",
|
||||
"message": "<p>This is the number of images with a width >1200px on mobile, >1800px on tablet, >2400 on desktop, >3200px on HD desktop. Try reducing their size.</p><p>Please ignore if the file is used as a sprite.</p>",
|
||||
"message": "<p>This rule compares the number of pixels in a loaded images to the number of physical pixels it is displayed on. Then it estimates the number of KB that could be saved by serving it with the correct dimensions.</p><p>Of course, it is hard to serve perfect images for all screens. For this reason, this rule is quite permissive.</p>",
|
||||
"isOkThreshold": 2048,
|
||||
"isBadThreshold": 307200,
|
||||
"isAbnormalThreshold": 512000,
|
||||
"hasOffenders": true,
|
||||
"unit": "bytes",
|
||||
"valueTransformFn": function(offenders) {
|
||||
let totalGain = 0;
|
||||
offenders.forEach((offender) => {
|
||||
offender.gain = offender.fileSize - offender.newFileSize;
|
||||
totalGain += offender.gain;
|
||||
});
|
||||
return totalGain;
|
||||
},
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return offenders;
|
||||
}
|
||||
},
|
||||
"imagesExcessiveDensity": {
|
||||
"tool": "phantomas",
|
||||
"label": "Excessive image density",
|
||||
"message": "<p>This metric measures the number of bytes that could be saved by going further than just resizing images.<p>Devices with very high pixel density screen (such as 3x or 4x) are programmed to load high density images. This is the normal behavior, however the human eye barely sees the difference over 2x. This metric alerts you if an image density is > 2.2x.</p><p>There is currently no browser functionnality to prevent the issue (for this reason its impact on global score is low). But you can build your own clever solution!</p>",
|
||||
"isOkThreshold": 102400,
|
||||
"isBadThreshold": 307200,
|
||||
"isAbnormalThreshold": 512000,
|
||||
"hasOffenders": true,
|
||||
"unit": "bytes",
|
||||
"valueTransformFn": function(offenders) {
|
||||
let totalGain = 0;
|
||||
offenders.forEach((offender) => {
|
||||
offender.gain = offender.fileSize - offender.newFileSize;
|
||||
totalGain += offender.gain;
|
||||
});
|
||||
return totalGain;
|
||||
},
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return offenders;
|
||||
}
|
||||
},
|
||||
"imagesWithIncorrectSizesParam": {
|
||||
"tool": "phantomas",
|
||||
"label": "Incorrect sizes parameter",
|
||||
"message": "<p>When using an adaptative image with a <i>srcset</i> attribute and <i>w</i> values, it is important to correctly set the <i>sizes</i> attribute. Otherwise, the browser might pick the wrong image in the <i>srcset</i>.</p><p>The <a href=\”https://chrome.google.com/webstore/detail/responsive-image-linter/mnddginionlghpblkimpdalcecpnbjln\" target=\"_blank\">Responsive Image Linter</a> extension for Chrome can help you further.</p>",
|
||||
"isOkThreshold": 0,
|
||||
"isBadThreshold": 5,
|
||||
"isAbnormalThreshold": 10,
|
||||
@@ -763,7 +837,7 @@ var policies = {
|
||||
"isBadThreshold": 204800,
|
||||
"isAbnormalThreshold": 409600,
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
"unit": "bytes"
|
||||
},
|
||||
"fileMinification": {
|
||||
"tool": "redownload",
|
||||
@@ -773,12 +847,12 @@ var policies = {
|
||||
"isBadThreshold": 61440,
|
||||
"isAbnormalThreshold": 122880,
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
"unit": "bytes"
|
||||
},
|
||||
"totalRequests": {
|
||||
"tool": "redownload",
|
||||
"label": "Requests number",
|
||||
"message": "<p>Each request slows down the page loading, especially on the protocol HTTP/1, but also a little on HTTP/2.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
||||
"message": "<p>Each request slows down the page loading, especially on the protocol HTTP/1, but also a little on HTTP/2 or 3.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
||||
"isOkThreshold": 80,
|
||||
"isBadThreshold": 240,
|
||||
"isAbnormalThreshold": 320,
|
||||
@@ -869,7 +943,7 @@ var policies = {
|
||||
"isOkThreshold": 0,
|
||||
"isBadThreshold": 102400,
|
||||
"isAbnormalThreshold": 204800,
|
||||
"unit": 'bytes',
|
||||
"unit": "bytes",
|
||||
"hasOffenders": true,
|
||||
"offendersTransformFn": function(offenders) {
|
||||
return offenders;
|
||||
@@ -895,7 +969,7 @@ var policies = {
|
||||
"isBadThreshold": 51200,
|
||||
"isAbnormalThreshold": 122880,
|
||||
"hasOffenders": true,
|
||||
"unit": 'bytes'
|
||||
"unit": "bytes"
|
||||
},
|
||||
"oldHttpProtocol": {
|
||||
"label": "HTTP protocols",
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
{
|
||||
"globalScore": {
|
||||
"pageWeight": 2,
|
||||
"images": 2,
|
||||
"domComplexity": 1,
|
||||
"javascriptComplexity": 2,
|
||||
"badJavascript": 2,
|
||||
"jQuery": 0.5,
|
||||
"cssComplexity": 0.5,
|
||||
"badCSS": 1,
|
||||
"fonts": 1,
|
||||
"serverConfig": 1
|
||||
},
|
||||
"categories": {
|
||||
"pageWeight": {
|
||||
"label": "Page weight",
|
||||
"label": "Network",
|
||||
"policies": {
|
||||
"totalWeight": 5,
|
||||
"imageOptimization": 2,
|
||||
"imagesTooLarge": 1,
|
||||
"compression": 2,
|
||||
"fileMinification": 2
|
||||
}
|
||||
},
|
||||
"requests": {
|
||||
"label": "Requests",
|
||||
"policies": {
|
||||
"totalRequests": 2,
|
||||
"domains": 3,
|
||||
"notFound": 2,
|
||||
"compression": 2,
|
||||
"fileMinification": 2,
|
||||
"identicalFiles": 2,
|
||||
"emptyRequests": 3,
|
||||
"notFound": 2
|
||||
}
|
||||
},
|
||||
"images": {
|
||||
"label": "Images",
|
||||
"policies": {
|
||||
"imagesNotOptimized": 2,
|
||||
"imagesOldFormat": 1,
|
||||
"imagesScaledDown": 2,
|
||||
"imagesExcessiveDensity": 0.25,
|
||||
"imagesWithIncorrectSizesParam": 1,
|
||||
"lazyLoadableImagesBelowTheFold": 2,
|
||||
"hiddenImages": 1
|
||||
}
|
||||
@@ -101,17 +116,5 @@
|
||||
"cachingTooShort": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"globalScore": {
|
||||
"pageWeight": 3,
|
||||
"requests": 2,
|
||||
"domComplexity": 2,
|
||||
"javascriptComplexity": 2,
|
||||
"badJavascript": 2,
|
||||
"jQuery": 0.5,
|
||||
"cssComplexity": 0.5,
|
||||
"badCSS": 1,
|
||||
"fonts": 1,
|
||||
"serverConfig": 1
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -57,9 +57,16 @@ var RulesChecker = function() {
|
||||
data.toolsResults[policy.tool].offenders[metricName]) {
|
||||
offenders = data.toolsResults[policy.tool].offenders[metricName];
|
||||
}
|
||||
|
||||
// It is possible to declare a transformation function for the main metric value.
|
||||
// The function should
|
||||
if (policy.valueTransformFn) {
|
||||
rule.value = policy.valueTransformFn(offenders);
|
||||
}
|
||||
|
||||
|
||||
var offendersObj = {};
|
||||
|
||||
|
||||
// It is possible to declare a transformation function for the offenders.
|
||||
// The function should take an array of strings as single parameter and return a string.
|
||||
if (policy.offendersTransformFn) {
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ var Runner = function(params) {
|
||||
});
|
||||
|
||||
// Fix: don't display Unicode ranges if the module is not present in Phantomas
|
||||
if (!data.toolsResults.phantomas.metrics.charactersCount) {
|
||||
if (!data.toolsResults.phantomas.metrics.differentCharacters) {
|
||||
delete data.toolsResults.redownload.metrics.unusedUnicodeRanges;
|
||||
delete data.toolsResults.redownload.offenders.unusedUnicodeRanges;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
var debug = require('debug')('ylt:screenshotHandlerAgent');
|
||||
var Jimp = require('jimp');
|
||||
var Q = require('q');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
|
||||
var screenshotHandler = function() {
|
||||
|
||||
this.findAndOptimizeScreenshot = function(tmpScreenshotPath, width) {
|
||||
var that = this;
|
||||
|
||||
debug('Starting screenshot transformation');
|
||||
|
||||
return this.openImage(tmpScreenshotPath)
|
||||
|
||||
.then(function(image) {
|
||||
that.deleteTmpFile(tmpScreenshotPath);
|
||||
return that.resizeImage(image, width);
|
||||
})
|
||||
|
||||
.then(this.toBuffer);
|
||||
};
|
||||
|
||||
|
||||
this.openImage = function(imagePath) {
|
||||
var deferred = Q.defer();
|
||||
|
||||
Jimp.read(imagePath, function(err, image){
|
||||
if (err) {
|
||||
debug('Could not open imagePath %s', imagePath);
|
||||
debug(err);
|
||||
|
||||
deferred.reject(err);
|
||||
} else {
|
||||
debug('Image correctly open');
|
||||
deferred.resolve(image);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
|
||||
this.resizeImage = function(image, newWidth) {
|
||||
var deferred = Q.defer();
|
||||
|
||||
var currentWidth = image.bitmap.width;
|
||||
|
||||
if (currentWidth > 0) {
|
||||
var ratio = newWidth / currentWidth;
|
||||
|
||||
image.scale(ratio, function(err, image){
|
||||
if (err) {
|
||||
debug('Could not resize image');
|
||||
debug(err);
|
||||
|
||||
deferred.reject(err);
|
||||
} else {
|
||||
debug('Image correctly resized');
|
||||
deferred.resolve(image);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
deferred.reject('Could not resize an empty image');
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
|
||||
this.toBuffer = function(image) {
|
||||
var deferred = Q.defer();
|
||||
|
||||
image.quality(85).getBuffer(Jimp.MIME_JPEG, function(err, buffer){
|
||||
if (err) {
|
||||
debug('Could not save image to buffer');
|
||||
debug(err);
|
||||
|
||||
deferred.reject(err);
|
||||
} else {
|
||||
debug('Image correctly transformed to buffer');
|
||||
deferred.resolve(buffer);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
|
||||
this.deleteTmpFile = function(tmpFilePath) {
|
||||
var deferred = Q.defer();
|
||||
|
||||
fs.unlink(tmpFilePath, function (err) {
|
||||
if (err) {
|
||||
debug('Screenshot temporary file not found, could not be deleted. But it is not a problem.');
|
||||
} else {
|
||||
debug('Screenshot temporary file deleted.');
|
||||
}
|
||||
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = new screenshotHandler();
|
||||
@@ -1,4 +1,3 @@
|
||||
var async = require('async');
|
||||
var Q = require('q');
|
||||
var path = require('path');
|
||||
var debug = require('debug')('ylt:phantomaswrapper');
|
||||
@@ -43,9 +42,12 @@ var PhantomasWrapper = function() {
|
||||
'block-domain': task.options.blockDomain,
|
||||
'allow-domain': task.options.allowDomain,
|
||||
'no-externals': task.options.noExternals,
|
||||
'local-storage': task.options.localStorage,
|
||||
'session-storage': task.options.sessionStorage,
|
||||
|
||||
// Mandatory
|
||||
'analyze-css': true,
|
||||
'analyze-images': true,
|
||||
'ignoreSslErrors': true, // until Phantomas 2.1
|
||||
'ignore-ssl-errors': true // for Phantomas >= 2.2
|
||||
};
|
||||
@@ -79,6 +81,12 @@ var PhantomasWrapper = function() {
|
||||
offenders: results.getAllOffenders()
|
||||
};
|
||||
|
||||
// Special rules here
|
||||
if (task.options.device !== 'phone') {
|
||||
delete json.metrics.imagesExcessiveDensity;
|
||||
delete json.offenders.imagesExcessiveDensity;
|
||||
}
|
||||
|
||||
deferred.resolve(json);
|
||||
}).
|
||||
catch(res => {
|
||||
|
||||
@@ -162,7 +162,7 @@ var FileMinifier = function() {
|
||||
var deferred = Q.defer();
|
||||
|
||||
try {
|
||||
var result = new CleanCSS({compatibility: 'ie8'}).minify(body);
|
||||
var result = new CleanCSS().minify(body);
|
||||
deferred.resolve(result.styles);
|
||||
} catch(err) {
|
||||
deferred.reject(err);
|
||||
|
||||
@@ -204,7 +204,10 @@ var ImageOptimizer = function() {
|
||||
} else if (type === 'png' && !lossy) {
|
||||
engine = imageminOptipng({optimizationLevel: OPTIPNG_COMPRESSION_LEVEL});
|
||||
} else if (type === 'svg' && !lossy) {
|
||||
engine = imageminSvgo({ plugins: [ { removeUselessDefs: false } ] });
|
||||
engine = imageminSvgo({plugins: [{
|
||||
name: 'preset-default',
|
||||
params: {overrides: {removeUselessDefs: false}}
|
||||
}]});
|
||||
} else {
|
||||
deferred.reject('No optimization engine found for imagemin');
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ var async = require('async');
|
||||
var request = require('request');
|
||||
var md5 = require('md5');
|
||||
|
||||
var imageOptimizer = require('./imageOptimizer');
|
||||
//var imageOptimizer = require('./imageOptimizer');
|
||||
var fileMinifier = require('./fileMinifier');
|
||||
var gzipCompressor = require('./gzipCompressor');
|
||||
var brotliCompressor = require('./brotliCompressor');
|
||||
var contentTypeChecker = require('./contentTypeChecker');
|
||||
var fontAnalyzer = require('./fontAnalyzer');
|
||||
var imageDimensions = require('./imageDimensions');
|
||||
//var imageDimensions = require('./imageDimensions');
|
||||
|
||||
|
||||
var Redownload = function() {
|
||||
@@ -63,10 +63,9 @@ var Redownload = function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent a bug with the font analyzer on empty pages
|
||||
var differentCharacters = '';
|
||||
if (data.toolsResults.phantomas.offenders.charactersCount && data.toolsResults.phantomas.offenders.charactersCount.length > 0) {
|
||||
differentCharacters = data.toolsResults.phantomas.offenders.charactersCount[0];
|
||||
if (data.toolsResults.phantomas.offenders.differentCharacters && data.toolsResults.phantomas.offenders.differentCharacters.length > 0) {
|
||||
differentCharacters = data.toolsResults.phantomas.offenders.differentCharacters[0];
|
||||
}
|
||||
|
||||
// Transform every request into a download function with a callback when done
|
||||
@@ -77,9 +76,9 @@ var Redownload = function() {
|
||||
|
||||
.then(contentTypeChecker.checkContentType)
|
||||
|
||||
.then(imageOptimizer.optimizeImage)
|
||||
//.then(imageOptimizer.optimizeImage)
|
||||
|
||||
.then(imageDimensions.getDimensions)
|
||||
//.then(imageDimensions.getDimensions)
|
||||
|
||||
.then(fileMinifier.minifyFile)
|
||||
|
||||
@@ -152,12 +151,12 @@ var Redownload = function() {
|
||||
});
|
||||
|
||||
// Image compression
|
||||
offenders.imageOptimization = listImagesNotOptimized(results);
|
||||
metrics.imageOptimization = offenders.imageOptimization.totalGain;
|
||||
//offenders.imageOptimization = listImagesNotOptimized(results);
|
||||
//metrics.imageOptimization = offenders.imageOptimization.totalGain;
|
||||
|
||||
// Image width
|
||||
offenders.imagesTooLarge = listImagesTooLarge(results, data.params.options.device);
|
||||
metrics.imagesTooLarge = offenders.imagesTooLarge.length;
|
||||
//offenders.imagesTooLarge = listImagesTooLarge(results, data.params.options.device);
|
||||
//metrics.imagesTooLarge = offenders.imagesTooLarge.length;
|
||||
|
||||
// File minification
|
||||
offenders.fileMinification = listFilesNotMinified(results);
|
||||
@@ -195,6 +194,8 @@ var Redownload = function() {
|
||||
offenders: offenders
|
||||
};
|
||||
|
||||
cleanResults(results);
|
||||
|
||||
deferred.resolve(data);
|
||||
}
|
||||
});
|
||||
@@ -340,7 +341,7 @@ var Redownload = function() {
|
||||
}
|
||||
|
||||
|
||||
function listImagesNotOptimized(requests) {
|
||||
/*function listImagesNotOptimized(requests) {
|
||||
var results = {
|
||||
totalGain: 0,
|
||||
images: []
|
||||
@@ -395,9 +396,9 @@ var Redownload = function() {
|
||||
}
|
||||
});
|
||||
return results;
|
||||
}
|
||||
}*/
|
||||
|
||||
function listImagesTooLarge(requests, device) {
|
||||
/*function listImagesTooLarge(requests, device) {
|
||||
var results = [];
|
||||
|
||||
requests.forEach(function(req) {
|
||||
@@ -422,7 +423,7 @@ var Redownload = function() {
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
function listFilesNotMinified(requests) {
|
||||
@@ -1010,6 +1011,13 @@ var Redownload = function() {
|
||||
}
|
||||
}
|
||||
|
||||
// Clean all the pollution this module added to the results
|
||||
function cleanResults(requests) {
|
||||
requests.forEach(function(req) {
|
||||
delete req.weightCheck;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
recheckAllFiles: recheckAllFiles,
|
||||
listRequestWeight: listRequestWeight,
|
||||
|
||||
+19
-17
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yellowlabtools",
|
||||
"version": "2.1.0",
|
||||
"version": "3.0.0",
|
||||
"description": "A tool that audits a webpage for performance and front-end quality issues",
|
||||
"license": "GPL-2.0",
|
||||
"author": {
|
||||
@@ -16,24 +16,24 @@
|
||||
"yellowlabtools": "./bin/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0"
|
||||
"node": ">= 18.0"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"async": "2.6.1",
|
||||
"clean-css": "4.2.1",
|
||||
"color-diff": "1.1.0",
|
||||
"color-diff": "1.4.0",
|
||||
"css-mq-parser": "0.0.3",
|
||||
"debug": "4.1.1",
|
||||
"debug": "4.3.4",
|
||||
"easyxml": "2.0.1",
|
||||
"fontkit": "1.7.8",
|
||||
"fontkit": "2.0.2",
|
||||
"html-minifier": "4.0.0",
|
||||
"image-size": "0.7.1",
|
||||
"image-size": "1.0.2",
|
||||
"imagemin": "7.0.1",
|
||||
"imagemin-jpegoptim": "7.0.0",
|
||||
"imagemin-jpegtran": "7.0.0",
|
||||
"imagemin-optipng": "8.0.0",
|
||||
"imagemin-svgo": "8.0.0",
|
||||
"imagemin-svgo": "9.0.0",
|
||||
"is-eot": "1.0.0",
|
||||
"is-gif": "3.0.0",
|
||||
"is-jpg": "2.0.0",
|
||||
@@ -45,24 +45,26 @@
|
||||
"is-webp": "1.0.1",
|
||||
"is-woff": "1.0.3",
|
||||
"is-woff2": "1.0.0",
|
||||
"md5": "2.2.1",
|
||||
"jimp": "0.22.8",
|
||||
"md5": "2.3.0",
|
||||
"meow": "5.0.0",
|
||||
"parse-color": "1.0.0",
|
||||
"phantomas": "2.2.0",
|
||||
"phantomas": "2.10.0",
|
||||
"q": "1.5.1",
|
||||
"request": "2.88.0",
|
||||
"ttf2woff2": "4.0.1",
|
||||
"uglify-js": "3.4.9",
|
||||
"request": "2.88.2",
|
||||
"sharp": "0.32.6",
|
||||
"ttf2woff2": "5.0.0",
|
||||
"uglify-js": "3.17.4",
|
||||
"woff-tools": "0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~4.2.0",
|
||||
"mocha": "~5.2.0",
|
||||
"sinon": "~7.2.3",
|
||||
"sinon-chai": "~3.3.0"
|
||||
"chai": "~4.3.7",
|
||||
"mocha": "~10.2.0",
|
||||
"sinon": "~15.2.0",
|
||||
"sinon-chai": "3.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "todo"
|
||||
"test": "mocha './test/core/**.js'"
|
||||
},
|
||||
"keywords": [
|
||||
"performance",
|
||||
|
||||
@@ -49,7 +49,7 @@ describe('colorDiff', function() {
|
||||
{url:'file.css', value: {message: '#5bc0de (2 times)'}},
|
||||
{url:'file.css', value: {message: 'rgba(0,0,0,0.075) (100 times)'}},
|
||||
{url:'file.css', value: {message: 'rgb(91,192,222) (1000 times)'}},
|
||||
{url:'file.css', value: {message: 'rgba(0,0,2,1) (1 times)'}},
|
||||
{url:'file.css', value: {message: 'rgba(0,0,1,1) (1 times)'}},
|
||||
{url:'file.css', value: {message: 'rgba(99,99,99,1) (1 times)'}},
|
||||
{url:'file.css', value: {message: 'rgba(100,100,100,1) (1 times)'}}
|
||||
];
|
||||
@@ -73,7 +73,7 @@ describe('colorDiff', function() {
|
||||
newData.toolsResults.colorDiff.offenders.should.have.a.property('similarColors').that.deep.equals([
|
||||
{
|
||||
color1: '#000',
|
||||
color2: 'rgba(0,0,2,1)',
|
||||
color2: 'rgba(0,0,1,1)',
|
||||
isDark: true
|
||||
},
|
||||
{
|
||||
|
||||
+10
-114
@@ -76,114 +76,6 @@ describe('customPolicies', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should transform DOMqueriesAvoidable offenders', function() {
|
||||
results = rulesChecker.check({
|
||||
"toolsResults": {
|
||||
"phantomas": {
|
||||
"metrics": {
|
||||
"DOMqueriesAvoidable": 2
|
||||
},
|
||||
"offenders": {
|
||||
"DOMqueriesDuplicated": [
|
||||
"id \"#j2t-top-cart\" with getElementById (in context #document): 4 queries",
|
||||
"class \".listingResult\" with getElementsByClassName (in context body > div#Global > div#Listing): 4 queries"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
|
||||
results.should.have.a.property('DOMqueriesAvoidable');
|
||||
results.DOMqueriesAvoidable.should.have.a.property('offendersObj').that.deep.equals({
|
||||
"count": 2,
|
||||
"list": [
|
||||
{
|
||||
"query": "#j2t-top-cart",
|
||||
"context": {
|
||||
"type": "document"
|
||||
},
|
||||
"fn": "getElementById ",
|
||||
"count": 4
|
||||
},
|
||||
{
|
||||
"query": ".listingResult",
|
||||
"context": {
|
||||
"type": "domElement",
|
||||
"element": "div#Listing",
|
||||
"tree": {
|
||||
"body": {
|
||||
"div#Global": {
|
||||
"div#Listing": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"fn": "getElementsByClassName ",
|
||||
"count": 4
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should transform jsErrors offenders', function() {
|
||||
results = rulesChecker.check({
|
||||
"toolsResults": {
|
||||
"phantomas": {
|
||||
"metrics": {
|
||||
"jsErrors": 2
|
||||
},
|
||||
"offenders": {
|
||||
"jsErrors": [
|
||||
"TypeError: 'undefined' is not a function (evaluating 'this.successfullyCollected.bind(this)') - http://asset.easydmp.net/js/collect.js:1160 / callCollecte http://asset.easydmp.net/js/collect.js:1203 / callbackUpdateParams http://asset.easydmp.net/js/collect.js:1135 / http://asset.easydmp.net/js/collect.js:1191",
|
||||
"TypeError: 'undefined' is not an object (evaluating 'd.readyState') - http://me.hunkal.com/p/:3"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
|
||||
results.should.have.a.property('jsErrors');
|
||||
results.jsErrors.should.have.a.property('offendersObj').that.deep.equals({
|
||||
"count": 2,
|
||||
"list": [
|
||||
{
|
||||
"error": "TypeError: 'undefined' is not a function (evaluating 'this.successfullyCollected.bind(this)')",
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "http://asset.easydmp.net/js/collect.js",
|
||||
"line": 1160
|
||||
},
|
||||
{
|
||||
"file": "http://asset.easydmp.net/js/collect.js",
|
||||
"line": 1203,
|
||||
"functionName": "callCollecte"
|
||||
},
|
||||
{
|
||||
"file": "http://asset.easydmp.net/js/collect.js",
|
||||
"line": 1135,
|
||||
"functionName": "callbackUpdateParams"
|
||||
},
|
||||
{
|
||||
"file": "http://asset.easydmp.net/js/collect.js",
|
||||
"line": 1191
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"error": "TypeError: 'undefined' is not an object (evaluating 'd.readyState')",
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "http://me.hunkal.com/p/",
|
||||
"line": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should grade correctly jQuery versions', function() {
|
||||
|
||||
var versions = {
|
||||
@@ -208,7 +100,8 @@ describe('customPolicies', function() {
|
||||
"phantomas": {
|
||||
"metrics": {
|
||||
"jQueryVersion": version
|
||||
}
|
||||
},
|
||||
"offenders": {}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
@@ -222,11 +115,12 @@ describe('customPolicies', function() {
|
||||
"phantomas": {
|
||||
"metrics": {
|
||||
"jQueryVersion": "wooot"
|
||||
}
|
||||
},
|
||||
"offenders": {}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
results.should.deep.equals({});
|
||||
results.should.not.have.a.property('jQueryVersion');
|
||||
|
||||
|
||||
// If jQueryVersionsLoaded is 0
|
||||
@@ -236,7 +130,8 @@ describe('customPolicies', function() {
|
||||
"metrics": {
|
||||
"jQueryVersion": "1.6.0",
|
||||
"jQueryVersionsLoaded": 0
|
||||
}
|
||||
},
|
||||
"offenders": {}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
@@ -252,14 +147,15 @@ describe('customPolicies', function() {
|
||||
"metrics": {
|
||||
"jQueryVersion": "1.6.0",
|
||||
"jQueryVersionsLoaded": 2
|
||||
}
|
||||
},
|
||||
"offenders": {}
|
||||
}
|
||||
}
|
||||
}, policies);
|
||||
results.should.not.have.a.property('jQueryVersion');
|
||||
results.should.have.a.property('jQueryVersionsLoaded');
|
||||
results.jQueryVersionsLoaded.should.have.a.property('score').that.equals(0);
|
||||
results.jQueryVersionsLoaded.should.have.a.property('abnormal').that.equals(true);
|
||||
results.jQueryVersionsLoaded.should.have.a.property('abnormal').that.equals(false);
|
||||
});
|
||||
|
||||
|
||||
|
||||
+17
-9
@@ -12,13 +12,13 @@ chai.use(sinonChai);
|
||||
describe('index.js', function() {
|
||||
|
||||
it('should return a promise', function() {
|
||||
var promise = ylt();
|
||||
/*var promise = ylt();
|
||||
|
||||
promise.should.have.property('then').that.is.a('function');
|
||||
promise.should.have.property('fail').that.is.a('function');
|
||||
promise.should.have.property('fail').that.is.a('function');*/
|
||||
});
|
||||
|
||||
it('should fail an undefined url', function(done) {
|
||||
it('should fail with an undefined url', function(done) {
|
||||
ylt().fail(function(err) {
|
||||
err.should.be.a('string').that.equals('URL missing');
|
||||
done();
|
||||
@@ -50,7 +50,7 @@ describe('index.js', function() {
|
||||
data.toolsResults.phantomas.should.be.an('object');
|
||||
data.toolsResults.phantomas.should.have.a.property('url').that.equals(url);
|
||||
data.toolsResults.phantomas.should.have.a.property('metrics').that.is.an('object');
|
||||
data.toolsResults.phantomas.metrics.should.have.a.property('requests').that.equals(1);
|
||||
data.toolsResults.phantomas.metrics.should.have.a.property('requests').that.equals(2);
|
||||
data.toolsResults.phantomas.should.have.a.property('offenders').that.is.an('object');
|
||||
data.toolsResults.phantomas.offenders.should.have.a.property('DOMelementMaxDepth');
|
||||
data.toolsResults.phantomas.offenders.DOMelementMaxDepth.should.have.length(2);
|
||||
@@ -66,13 +66,14 @@ describe('index.js', function() {
|
||||
"tool": "phantomas",
|
||||
"label": "DOM max depth",
|
||||
"message": "<p>A deep DOM makes the CSS matching with DOM elements difficult.</p><p>It also slows down JavaScript modifications to the DOM because changing the dimensions of an element makes the browser re-calculate the dimensions of it's parents. Same thing for JavaScript events, that bubble up to the document root.</p>",
|
||||
"isOkThreshold": 12,
|
||||
"isBadThreshold": 22,
|
||||
"isAbnormalThreshold": 30,
|
||||
"isOkThreshold": 15,
|
||||
"isBadThreshold": 25,
|
||||
"isAbnormalThreshold": 32,
|
||||
"hasOffenders": true
|
||||
},
|
||||
"value": 1,
|
||||
"bad": false,
|
||||
"globalScoreIfFixed": 98,
|
||||
"abnormal": false,
|
||||
"score": 100,
|
||||
"abnormalityScore": 0,
|
||||
@@ -90,10 +91,10 @@ describe('index.js', function() {
|
||||
/*jshint expr: true*/
|
||||
console.log.should.not.have.been.called;
|
||||
|
||||
console.log.restore();
|
||||
//console.log.restore();
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
console.log.restore();
|
||||
//console.log.restore();
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -105,6 +106,7 @@ describe('index.js', function() {
|
||||
|
||||
ylt(url)
|
||||
.then(function(data) {
|
||||
console.log(data.toolsResults.phantomas.offenders.jsErrors);
|
||||
data.toolsResults.phantomas.metrics.should.have.a.property('jsErrors').that.equals(0);
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
@@ -119,6 +121,10 @@ describe('index.js', function() {
|
||||
var url = 'http://localhost:8388/simple-page.html';
|
||||
var screenshotPath = path.join(__dirname, '../../.tmp/indexTestScreenshot.png');
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, '../../.tmp'))){
|
||||
fs.mkdirSync(path.join(__dirname, '../../.tmp'));
|
||||
}
|
||||
|
||||
ylt(url, {screenshot: screenshotPath})
|
||||
.then(function(data) {
|
||||
|
||||
@@ -130,6 +136,8 @@ describe('index.js', function() {
|
||||
done();
|
||||
}).fail(function(err) {
|
||||
done(err);
|
||||
}).finally(function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
var should = require('chai').should();
|
||||
var isHttp2 = require('../../lib/tools/isHttp2');
|
||||
|
||||
describe('isHttp2', function() {
|
||||
|
||||
it('should parse the protocol correctly', function() {
|
||||
isHttp2.getProtocol({
|
||||
toolsResults: {
|
||||
phantomas: {
|
||||
url: 'http://www.yahoo.com'
|
||||
}
|
||||
}
|
||||
}).should.equal('http:');
|
||||
|
||||
|
||||
isHttp2.getProtocol({
|
||||
toolsResults: {
|
||||
phantomas: {
|
||||
url: 'https://www.yahoo.com'
|
||||
}
|
||||
}
|
||||
}).should.equal('https:');
|
||||
});
|
||||
|
||||
it('should parse the domain correctly', function() {
|
||||
isHttp2.getDomain({
|
||||
toolsResults: {
|
||||
phantomas: {
|
||||
url: 'http://www.yahoo.com'
|
||||
}
|
||||
}
|
||||
}).should.equal('www.yahoo.com');
|
||||
|
||||
|
||||
isHttp2.getDomain({
|
||||
toolsResults: {
|
||||
phantomas: {
|
||||
url: 'https://www.yahoo.com'
|
||||
}
|
||||
}
|
||||
}).should.equal('www.yahoo.com');
|
||||
});
|
||||
|
||||
it('should have a function checkHttp2', function() {
|
||||
isHttp2.should.have.a.property('checkHttp2').that.is.a('function');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -82,16 +82,9 @@ describe('redownload', function() {
|
||||
data.toolsResults.redownload.offenders.totalWeight.byType.image.requests.length.should.equal(2);
|
||||
data.toolsResults.redownload.offenders.totalWeight.byType.other.requests.length.should.equal(1);
|
||||
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('imageOptimization');
|
||||
data.toolsResults.redownload.offenders.imageOptimization.totalGain.should.be.above(0);
|
||||
data.toolsResults.redownload.offenders.imageOptimization.images.length.should.equal(2);
|
||||
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('imagesTooLarge');
|
||||
data.toolsResults.redownload.offenders.imagesTooLarge.length.should.equal(0);
|
||||
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('gzipCompression');
|
||||
data.toolsResults.redownload.offenders.gzipCompression.totalGain.should.be.above(0);
|
||||
data.toolsResults.redownload.offenders.gzipCompression.files.length.should.equal(5);
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('compression');
|
||||
data.toolsResults.redownload.offenders.compression.totalGain.should.be.above(0);
|
||||
data.toolsResults.redownload.offenders.compression.files.length.should.equal(5);
|
||||
|
||||
data.toolsResults.redownload.offenders.should.have.a.property('fileMinification');
|
||||
data.toolsResults.redownload.offenders.fileMinification.totalGain.should.be.above(0);
|
||||
@@ -224,7 +217,8 @@ describe('redownload', function() {
|
||||
},
|
||||
status: 302,
|
||||
isHTML: true,
|
||||
contentLength: 999
|
||||
contentLength: 999,
|
||||
notFound: true
|
||||
};
|
||||
|
||||
redownload.redownloadEntry(entry)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
document.getElementById(undefined);
|
||||
document.getElementsByClassName(undefined);
|
||||
document.getElementsByTagName(undefined);
|
||||
document.querySelector(undefined);
|
||||
|
||||
} catch(err) {
|
||||
console.log('Error found: ' + err);
|
||||
|
||||
Reference in New Issue
Block a user