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

Unified Diff: test/elemHide.js

Issue 30002601: Issue 7284 - Move CSS escaping to createStyleSheet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Reworked the escaping of selectors Created Feb. 12, 2019, 11:50 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
Index: test/elemHide.js
===================================================================
--- a/test/elemHide.js
+++ b/test/elemHide.js
@@ -292,17 +292,19 @@
"html", "#foo", ".bar", "#foo .bar", "#foo > .bar",
"#foo[data-bar='bar']"
]),
"html, #foo, .bar, #foo .bar, #foo > .bar, #foo[data-bar='bar'] " +
"{display: none !important;}\n",
"Style sheet creation should work"
);
- let selectors = new Array(50000).map((element, index) => ".s" + index);
+ let selectors = new Array(50000);
+ for (let index = 0; index < selectors.length; index++)
+ selectors[index] = ".s" + index;
hub 2019/02/12 23:55:49 The previous version of the code produced an Array
Manish Jethani 2019/02/13 12:27:25 I see, `Array.prototype.map` skips empty items. T
test.equal((createStyleSheet(selectors).match(/\n/g) || []).length,
Math.ceil(50000 / selectorGroupSize),
"Style sheet should be split up into rules with at most " +
selectorGroupSize + " selectors each");
test.done();
};

Powered by Google App Engine
This is Rietveld