Index: chrome/content/elemHideEmulation.js |
=================================================================== |
--- a/chrome/content/elemHideEmulation.js |
+++ b/chrome/content/elemHideEmulation.js |
@@ -184,16 +184,17 @@ |
*/ |
*getSelectors(prefix, subtree, styles) |
{ |
yield [prefix + this._selector, subtree]; |
} |
}; |
const incompletePrefixRegexp = /[\s>+~]$/; |
+const relativeSelectorRegexp = /^[>+~]/; |
function HasSelector(selectors) |
{ |
this._innerSelectors = selectors; |
} |
HasSelector.prototype = { |
requiresHiding: true, |
@@ -219,18 +220,29 @@ |
{ |
let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? |
prefix + "*" : prefix; |
let elements = subtree.querySelectorAll(actualPrefix); |
for (let element of elements) |
{ |
let iter = evaluate(this._innerSelectors, 0, "", element, styles); |
for (let selector of iter) |
- if (element.querySelector(selector)) |
- yield element; |
+ { |
+ // :scope isn't supported on Edge. It still is not standard. |
Wladimir Palant
2017/08/16 08:17:15
What do you mean by "not standard"? It's part of t
hub
2017/08/16 15:30:45
Done.
|
+ if (relativeSelectorRegexp.test(selector)) |
+ selector = ":scope" + selector; |
+ try |
+ { |
+ if (element.querySelector(selector)) |
+ yield element; |
+ } |
+ catch (e) |
+ { |
+ } |
+ } |
} |
} |
}; |
function ContainsSelector(textContent) |
{ |
this._text = textContent; |
} |