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

Unified Diff: lib/elemHide.js

Issue 29782589: Issue 6669 - Remove unused ElemHide.NO_UNCONDITIONAL constant (Closed)
Patch Set: Created May 15, 2018, 12:19 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 | test/elemHide.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
diff --git a/lib/elemHide.js b/lib/elemHide.js
index 7343e2c0266a92f7c23431552667559cde5bb1f6..f4affa97c88843fd03e67f77234982fd5f19ccd4 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -101,7 +101,7 @@ function getUnconditionalSelectors()
* Container for element hiding filters
* @class
*/
-let ElemHide = exports.ElemHide = {
+exports.ElemHide = {
/**
* Removes all known filters
*/
@@ -222,45 +222,17 @@ let ElemHide = exports.ElemHide = {
return null;
},
- /**
- * Constant used by getSelectorsForDomain to return all selectors applying to
- * a particular hostname.
- * @type {number}
- * @const
- */
- ALL_MATCHING: 0,
-
- /**
- * Constant used by getSelectorsForDomain to exclude selectors which apply to
- * all websites without exception.
- * @type {number}
- * @const
- */
- NO_UNCONDITIONAL: 1,
-
- /**
- * Constant used by getSelectorsForDomain to return only selectors for filters
- * which specifically match the given host name.
- * @type {number}
- * @const
- */
- SPECIFIC_ONLY: 2,
-
/**
* Determines from the current filter list which selectors should be applied
* on a particular host name.
* @param {string} domain
- * @param {number} [criteria]
- * One of the following: ElemHide.ALL_MATCHING, ElemHide.NO_UNCONDITIONAL or
- * ElemHide.SPECIFIC_ONLY.
- * @returns {string[]}
- * List of selectors.
+ * @param {boolean} [specificOnly] true if generic filters should not apply.
+ * @returns {string[]} List of selectors.
*/
- getSelectorsForDomain(domain, criteria = ElemHide.ALL_MATCHING)
+ getSelectorsForDomain(domain, specificOnly = false)
{
let selectors = [];
- let specificOnly = (criteria >= ElemHide.SPECIFIC_ONLY);
let excluded = new Set();
let currentDomain = domain ? domain.toUpperCase() : "";
@@ -295,7 +267,7 @@ let ElemHide = exports.ElemHide = {
currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1);
}
- if (criteria < ElemHide.NO_UNCONDITIONAL)
+ if (!specificOnly)
selectors = getUnconditionalSelectors().concat(selectors);
return selectors;
« no previous file with comments | « no previous file | test/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld