Index: lib/content/elemHideEmulation.js |
=================================================================== |
--- a/lib/content/elemHideEmulation.js |
+++ b/lib/content/elemHideEmulation.js |
@@ -325,20 +325,33 @@ |
}, |
*getElements(prefix, subtree, styles) |
{ |
let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? |
prefix + "*" : prefix; |
let elements = scopedQuerySelectorAll(subtree, actualPrefix); |
+ |
if (elements) |
{ |
+ let lastRoot = null; |
for (let element of elements) |
{ |
+ // For a filter like div:-abp-contains(Hello) and a subtree like |
+ // <div id="a"><div id="b"><div id="c">Hello</div></div></div> |
+ // we're only interested in div#a |
+ if (lastRoot && lastRoot.contains(element)) |
+ { |
+ yield null; |
+ continue; |
+ } |
+ |
+ lastRoot = element; |
+ |
if (this._regexp && this._regexp.test(element.textContent)) |
yield element; |
else |
yield null; |
} |
} |
} |
}; |