| Index: lib/filterClasses.js |
| =================================================================== |
| --- a/lib/filterClasses.js |
| +++ b/lib/filterClasses.js |
| @@ -1062,27 +1062,31 @@ |
| // Note: The ContentFilter.prototype.domainSeparator is duplicated here, if |
| // that changes this must be changed too. |
| if (domains && /(^|,)~?(,|$)/.test(domains)) |
| return new InvalidFilter(text, "filter_invalid_domain"); |
| if (type == "@") |
| return new ElemHideException(text, domains, body); |
| - if (type == "$") |
| - return new SnippetFilter(text, domains, body); |
| - |
| - if (type == "?") |
| + if (type == "?" || type == "$") |
| { |
| - // Element hiding emulation filters are inefficient so we need to make sure |
| - // that they're only applied if they specify active domains |
| + // Element hiding emulation and snippet filters are inefficient so we need |
| + // to make sure that they're only applied if they specify active domains |
| if (!/,[^~][^,.]*\.[^,]/.test("," + domains)) |
| - return new InvalidFilter(text, "filter_elemhideemulation_nodomain"); |
| + { |
| + return new InvalidFilter(text, type == "?" ? |
| + "filter_elemhideemulation_nodomain" : |
| + "filter_snippet_nodomain"); |
| + } |
| - return new ElemHideEmulationFilter(text, domains, body); |
| + if (type == "?") |
| + return new ElemHideEmulationFilter(text, domains, body); |
| + |
| + return new SnippetFilter(text, domains, body); |
| } |
| return new ElemHideFilter(text, domains, body); |
| }; |
| /** |
| * Base class for element hiding filters |
| * @param {string} text see {@link Filter Filter()} |