浏览代码

Merge pull request #148 from gmetais/hidden-pixels

Merged
Gaël Métais 9 年之前
父节点
当前提交
6d6608754d
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      lib/metadata/policies.js
  2. 2 0
      lib/tools/phantomas/custom_modules/modules/domHiddenYLT/domHiddenYLT.js

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