Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -354,33 +354,39 @@ |
/** |
* Generates a style sheet for a given domain based on the current set of |
* filters. |
* |
* @param {string} domain The domain. |
* @param {boolean} [specificOnly=false] Whether selectors from generic |
* filters should be included. |
+ * @param {boolean} [includeSelectors=true] Whether the return value should |
+ * include a separate list of selectors. |
* |
* @returns {ElemHideStyleSheet} An object containing the CSS code and the |
* list of selectors. |
*/ |
- generateStyleSheetForDomain(domain, specificOnly = false) |
+ generateStyleSheetForDomain(domain, specificOnly = false, |
+ includeSelectors = true) |
{ |
let knownSuffix = domain ? getKnownSuffix(domain) : ""; |
- let selectors = getConditionalSelectorsForDomain(knownSuffix, specificOnly); |
+ let selectors = []; |
+ if (includeSelectors || knownSuffix != "") |
+ selectors = getConditionalSelectorsForDomain(knownSuffix, specificOnly); |
+ |
let code = specificOnly ? createStyleSheet(selectors) : |
knownSuffix == "" ? getCommonStyleSheet() : |
(getDefaultStyleSheet() + createStyleSheet(selectors)); |
- if (!specificOnly) |
+ if (includeSelectors && !specificOnly) |
selectors = getUnconditionalSelectors().concat(selectors); |
- return {code, selectors}; |
+ return {code, selectors: includeSelectors ? selectors : null}; |
} |
}; |
/** |
* Splits a list of selectors into groups determined by the value of |
* <code>{@link selectorGroupSize}</code>. |
* |
* @param {Array.<string>} selectors |