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()}
Index: test/snippets.js
===================================================================
--- a/test/snippets.js
+++ b/test/snippets.js
@@ -20,57 +20,70 @@
 "use strict";
 
 const {createSandbox} = require("./_common");
 
 let Snippets = null;
 let parseScript = null;
 let compileScript = null;
 let Filter = null;
+let SnippetFilter = null;
 
 exports.setUp = function(callback)
 {
   let sandboxedRequire = createSandbox();
   (
-    {Filter} = sandboxedRequire("../lib/filterClasses"),
+    {Filter, SnippetFilter} = sandboxedRequire("../lib/filterClasses"),
     {Snippets, parseScript, compileScript} = sandboxedRequire("../lib/snippets")
   );
 
   callback();
 };
 
 exports.testDomainRestrictions = function(test)
 {
   function testScriptMatches(description, filters, domain, expectedMatches)
   {
-    for (let filter of filters)
-      Snippets.add(Filter.fromText(filter));
+    for (let filter of filters.map(Filter.fromText))
+    {
+      if (filter instanceof SnippetFilter)
+        Snippets.add(filter);
+    }
 
     let matches = Snippets.getScriptsForDomain(domain);
     test.deepEqual(matches.sort(), expectedMatches.sort(), description);
 
     Snippets.clear();
   }
 
   testScriptMatches(
+    "Ignore generic filters",
+    [
+      "#$#foo-1", "example.com#$#foo-2",
+      "~example.com#$#foo-3"
+    ],
+    "example.com",
+    ["foo-2"]
+  );
+  testScriptMatches(
     "Ignore filters that include parent domain but exclude subdomain",
     [
       "~www.example.com,example.com#$#foo"
     ],
     "www.example.com",
     []
   );
   testScriptMatches(
     "Ignore filters for other subdomain",
     [
-      "www.example.com#$#foo",
-      "other.example.com#$#foo"
+      "www.example.com#$#foo-1",
+      "other.example.com#$#foo-2"
     ],
     "other.example.com",
-    ["foo"]
+    ["foo-2"]
   );
 
   test.done();
 };
 
 exports.testSnippetFiltersContainer = function(test)
 {
   function compareRules(description, domain, expectedMatches)
