From 1e60a4307599c9a53db0dbed803b8058a6970789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Mon, 25 May 2015 11:42:47 +0200 Subject: [PATCH] Don't count duplicated queries on elements not attached to DOM --- .../phantomas/custom_modules/modules/domQYLT/domQYLT.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js b/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js index cbae27f..4d71dac 100644 --- a/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js +++ b/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js @@ -365,7 +365,12 @@ exports.module = function(phantomas) { phantomas.log('DOM query: by %s - "%s" (using %s) in %s', type, query, fnName, context); phantomas.incrMetric('DOMqueries'); - if (context && context.indexOf('DocumentFragment') === -1) { + if (context && ( + context.indexOf('html') === 0 || + context.indexOf('body') === 0 || + context.indexOf('head') === 0 || + context.indexOf('#document') === 0 + )) { DOMqueries.push(type + ' "' + query + '" with ' + fnName + ' (in context ' + context + ')'); } });