Browse Source

Merge pull request #148 from gmetais/hidden-pixels

Merged
Gaël Métais 9 years ago
parent
commit
6d6608754d

+ 1 - 1
lib/metadata/policies.js

@@ -1075,7 +1075,7 @@ var policies = {
     "hiddenImages": {
         "tool": "phantomas",
         "label": "Hidden images",
-        "message": "<p>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.</p><p>Trackers are an exception, you'd better hide them.</p>",
+        "message": "<p>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.</p><p>As images displayed in 1x1 pixels tend to be trackers, they are excluded from this rule.</p>",
         "isOkThreshold": 1,
         "isBadThreshold": 12,
         "isAbnormalThreshold": 30,

+ 2 - 0
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]);