Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -353,21 +353,24 @@ |
/** |
* 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=false] 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 = false) |
{ |
let code = null; |
let selectors = null; |
if (domain[domain.length - 1] == ".") |
domain = domain.replace(/\.+$/, ""); |
domain = domain.toLowerCase(); |
@@ -376,24 +379,34 @@ |
{ |
selectors = getConditionalSelectors(domain, true); |
code = createStyleSheet(selectors); |
} |
else |
{ |
let knownSuffix = getKnownSuffix(domain); |
- selectors = getConditionalSelectors(knownSuffix, false); |
- code = knownSuffix == "" ? getCommonStyleSheet() : |
- (getDefaultStyleSheet() + createStyleSheet(selectors)); |
+ if (includeSelectors) |
+ { |
+ selectors = getConditionalSelectors(knownSuffix, false); |
+ code = knownSuffix == "" ? getCommonStyleSheet() : |
+ (getDefaultStyleSheet() + createStyleSheet(selectors)); |
- selectors = getUnconditionalSelectors().concat(selectors); |
+ selectors = getUnconditionalSelectors().concat(selectors); |
+ } |
+ else |
+ { |
+ code = knownSuffix == "" ? getCommonStyleSheet() : |
+ (getDefaultStyleSheet() + |
+ createStyleSheet(getConditionalSelectors(knownSuffix, |
+ false))); |
+ } |
} |
- 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 |