From a900f0ff6558113c9c4bd559e45ecd48d4b31981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Mon, 14 Sep 2015 22:54:17 +0200 Subject: [PATCH] Cooler DOMaccessesOnScroll rule --- lib/metadata/policies.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index 96cfee3..e7aab2c 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -152,8 +152,8 @@ var policies = { "label": "DOM access on scroll", "message": "

This rule counts the number of DOM-accessing functions calls on a scroll event, such as queries, readings, writings, bindings and jQuery functions.

Two scroll events are triggered quickly, one after the other, and only the second one is analyzed so throttled functions are ignored.

One of the main reasons of a poor scrolling experience is when too much JS is executed on each scroll event. Note that some devices such as smartphones and MacBooks send more scroll events than others.

Reduce the number of DOM accesses inside scroll listeners. Put DOM queries outside them when possible. Use throttling or debouncing.

", "isOkThreshold": 1, - "isBadThreshold": 12, - "isAbnormalThreshold": 25, + "isBadThreshold": 20, + "isAbnormalThreshold": 35, "hasOffenders": true, "offendersTransformFn": function(offenders) { return offenders;