Update Phantomas version

This commit is contained in:
Gaël Métais
2014-09-17 13:22:05 +02:00
parent 135cddb121
commit 2714b2bd11
2 changed files with 2 additions and 23 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
"url": "git://github.com/gmetais/YellowLabTools.git"
},
"dependencies": {
"phantomas": "1.5.0",
"phantomas": "1.6.0",
"express": "~4.9.0",
"async": "~0.9.0",
"socket.io": "~1.1.0",
@@ -3,7 +3,7 @@
*/
/* global document: true, Node: true, window: true */
exports.version = '0.3.a';
exports.version = '0.4.a';
exports.module = function(phantomas) {
'use strict';
@@ -11,9 +11,6 @@ exports.module = function(phantomas) {
// total length of HTML comments (including <!-- --> brackets)
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)
phantomas.setMetric('whiteSpacesSize'); // @desc the size of text nodes with whitespaces only
@@ -77,24 +74,6 @@ exports.module = function(phantomas) {
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
if (node.hasAttribute('style')) {
phantomas.incrMetric('nodesWithInlineCSS');