Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -271,37 +271,41 @@ |
// this could still lead to some selectors not working on Chromium, but it is |
// highly unlikely. |
// See issue #6298 and https://crbug.com/804179 |
for (let i = 0; i < selectors.length; i += selectorGroupSize) |
yield selectors.slice(i, i + selectorGroupSize); |
} |
/** |
- * Creates element hiding CSS rules for a given list of selectors. Each rule |
- * contains no more than the maximum number of selectors as determined by the |
- * value of <code>{@link selectorGroupSize}</code>. |
+ * Creates an element hiding CSS rule for a given list of selectors. |
* |
* @param {Array.<string>} selectors |
- * @yields {string} |
+ * @returns {string} |
*/ |
-function* createRules(selectors) |
+function createRule(selectors) |
{ |
- for (let selectorGroup of splitSelectors(selectors)) |
- yield selectorGroup.join(", ") + " {display: none !important;}"; |
+ let rule = ""; |
+ |
+ for (let i = 0; i < selectors.length - 1; i++) |
Manish Jethani
2018/09/26 15:29:56
I tried a few things here:
1. Used `for...of` a
hub
2018/09/26 16:49:11
Acknowledged.
|
+ rule += selectors[i] + ", "; |
+ |
+ rule += selectors[selectors.length - 1] + " {display: none !important;}\n"; |
+ |
+ return rule; |
} |
/** |
* Creates an element hiding CSS style sheet from a given list of selectors. |
* @param {Array.<string>} selectors |
* @returns {string} |
*/ |
function createStyleSheet(selectors) |
{ |
let styleSheet = ""; |
- for (let rule of createRules(selectors)) |
- styleSheet += rule + "\n"; |
+ for (let selectorGroup of splitSelectors(selectors)) |
+ styleSheet += createRule(selectorGroup); |
return styleSheet; |
} |
exports.createStyleSheet = createStyleSheet; |