Ver código fonte

Update Phantomas version

Gaël Métais 10 anos atrás
pai
commit
2714b2bd11

+ 1 - 1
package.json

@@ -6,7 +6,7 @@
     "url": "git://github.com/gmetais/YellowLabTools.git"
     "url": "git://github.com/gmetais/YellowLabTools.git"
   },
   },
   "dependencies": {
   "dependencies": {
-    "phantomas": "1.5.0",
+    "phantomas": "1.6.0",
     "express": "~4.9.0",
     "express": "~4.9.0",
     "async": "~0.9.0",
     "async": "~0.9.0",
     "socket.io": "~1.1.0",
     "socket.io": "~1.1.0",

+ 1 - 22
phantomas_custom/modules/domComplexYLT/domComplexYLT.js

@@ -3,7 +3,7 @@
  */
  */
 /* global document: true, Node: true, window: true */
 /* global document: true, Node: true, window: true */
 
 
-exports.version = '0.3.a';
+exports.version = '0.4.a';
 
 
 exports.module = function(phantomas) {
 exports.module = function(phantomas) {
     'use strict';
     'use strict';
@@ -11,9 +11,6 @@ exports.module = function(phantomas) {
     // total length of HTML comments (including <!-- --> brackets)
     // total length of HTML comments (including <!-- --> brackets)
     phantomas.setMetric('commentsSize'); // @desc the size of HTML comments on the page @offenders
     phantomas.setMetric('commentsSize'); // @desc the size of HTML comments on the page @offenders
 
 
-    // total length of HTML of hidden elements (i.e. display: none)
-    phantomas.setMetric('hiddenContentSize'); // @desc the size of content of hidden elements on the page (with CSS display: none) @offenders
-
     // total length of text nodes with whitespaces only (i.e. pretty formatting of HTML)
     // total length of text nodes with whitespaces only (i.e. pretty formatting of HTML)
     phantomas.setMetric('whiteSpacesSize'); // @desc the size of text nodes with whitespaces only
     phantomas.setMetric('whiteSpacesSize'); // @desc the size of text nodes with whitespaces only
 
 
@@ -77,24 +74,6 @@ exports.module = function(phantomas) {
                                 return false;
                                 return false;
                             }
                             }
 
 
-                            // @see https://developer.mozilla.org/en/DOM%3awindow.getComputedStyle
-                            var styles = window.getComputedStyle(node);
-
-                            if (styles && styles.getPropertyValue('display') === 'none') {
-                                if (typeof node.innerHTML === 'string') {
-                                    size = node.innerHTML.length;
-                                    phantomas.incrMetric('hiddenContentSize', size);
-
-                                    // log hidden containers bigger than 1 kB
-                                    if (size > 1024) {
-                                        phantomas.addOffender('hiddenContentSize', phantomas.getDOMPath(node) + ' (' + size + ' characters)');
-                                    }
-                                }
-
-                                // don't run for child nodes as they're hidden as well
-                                return false;
-                            }
-
                             // count nodes with inline CSS
                             // count nodes with inline CSS
                             if (node.hasAttribute('style')) {
                             if (node.hasAttribute('style')) {
                                 phantomas.incrMetric('nodesWithInlineCSS');
                                 phantomas.incrMetric('nodesWithInlineCSS');