Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -1126,17 +1126,18 @@
 
   if (type == "@")
     return new ElemHideException(text, domains, body);
 
   if (type == "?" || type == "$")
   {
     // 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))
+    if (!(/,[^~][^,.]*\.[^,]/.test("," + domains) ||
+          ("," + domains + ",").includes(",localhost,")))
     {
       return new InvalidFilter(text, type == "?" ?
                                        "filter_elemhideemulation_nodomain" :
                                        "filter_snippet_nodomain");
     }
 
     if (type == "?")
       return new ElemHideEmulationFilter(text, domains, body);
