Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.preload.js

Issue 29341238: Issue 4036 - Speed up addElemHideSelectors for Chrome >50 (Closed)
Patch Set: Created May 11, 2016, 3:32 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
diff --git a/include.preload.js b/include.preload.js
index 425c11eefde0b1404005c3274004e9b9ea36556d..cd418c734e3a2fb2ab7939057187399831966f97 100644
--- a/include.preload.js
+++ b/include.preload.js
@@ -459,9 +459,9 @@ function init(document)
// WebKit (and Blink?) apparently chokes when the selector list in a
// CSS rule is huge. So we split the elemhide selectors into groups.
- while (selectors.length > 0)
+ for (var i = 0; i < selectors.length; i += SELECTOR_GROUP_SIZE)
{
- var selector = selectors.splice(0, SELECTOR_GROUP_SIZE).join(", ");
+ var selector = selectors.slice(i, i + SELECTOR_GROUP_SIZE).join(", ");
style.sheet.addRule(selector, "display: none !important;");
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld