From 3ff23e1c476b1e9edddf5549d15ac9b0174b67d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sun, 27 Mar 2016 17:18:28 +0300 Subject: [PATCH 1/2] Ignore 1x1 images in hiddenImages rule --- .../custom_modules/modules/domHiddenYLT/domHiddenYLT.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tools/phantomas/custom_modules/modules/domHiddenYLT/domHiddenYLT.js b/lib/tools/phantomas/custom_modules/modules/domHiddenYLT/domHiddenYLT.js index 097aef7..a90e2bf 100644 --- a/lib/tools/phantomas/custom_modules/modules/domHiddenYLT/domHiddenYLT.js +++ b/lib/tools/phantomas/custom_modules/modules/domHiddenYLT/domHiddenYLT.js @@ -52,6 +52,8 @@ exports.module = function(phantomas) { if (src === '' || src.indexOf('data:image') === 0) continue; + if (images[i].width === 1 && images[i].height === 1) continue; + if (!lazyLoadableImages[src]) { path = phantomas.getDOMPath(images[i]); From 326bfc035f4479b1f262c82d6da79b1b03bd7f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sun, 27 Mar 2016 17:35:01 +0300 Subject: [PATCH 2/2] Update rule explaination --- lib/metadata/policies.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index 9c7b9e2..40a1b38 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -1075,7 +1075,7 @@ var policies = { "hiddenImages": { "tool": "phantomas", "label": "Hidden images", - "message": "

List of all images that have a display:none property, or one of their parents. These images are loaded by the browser even if they're not visible. You might be able to find a way to lazy-load them, only when they get visible.

Trackers are an exception, you'd better hide them.

", + "message": "

List of all images that have a display:none property, or one of their parents. These images are loaded by the browser even if they're not visible. You might be able to find a way to lazy-load them, only when they get visible.

As images displayed in 1x1 pixels tend to be trackers, they are excluded from this rule.

", "isOkThreshold": 1, "isBadThreshold": 12, "isAbnormalThreshold": 30,