aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-07-30 12:29:37 -0400
committergorhill <rhill@raymondhill.net>2015-07-30 12:29:37 -0400
commit595b239df17ac57889c76f2d7b6448d3cf072b76 (patch)
treeaa633d3a036dbc0dc9c63b68f3c1cc160ef3ac4e
parent2560a81a27a5490444dca700d4e10398f8d6a7be (diff)
downloaduBlock-595b239df17ac57889c76f2d7b6448d3cf072b76.zip
uBlock-595b239df17ac57889c76f2d7b6448d3cf072b76.tar.gz
uBlock-595b239df17ac57889c76f2d7b6448d3cf072b76.tar.bz2
this fixes #546
-rw-r--r--src/js/scriptlets/dom-inspector.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/js/scriptlets/dom-inspector.js b/src/js/scriptlets/dom-inspector.js
index 9c19ec7..2ea07cb 100644
--- a/src/js/scriptlets/dom-inspector.js
+++ b/src/js/scriptlets/dom-inspector.js
@@ -686,6 +686,15 @@ var cosmeticFilterFromTarget = function(nid, coarseSelector) {
/******************************************************************************/
var cosmeticFilterMapper = (function() {
+ // https://github.com/gorhill/uBlock/issues/546
+ var matchesFnName;
+ if ( typeof document.body.matches === 'function' ) {
+ matchesFnName = 'matches';
+ } else if ( typeof document.body.mozMatchesSelector === 'function' ) {
+ matchesFnName = 'mozMatchesSelector';
+ } else if ( typeof document.body.webkitMatchesSelector === 'function' ) {
+ matchesFnName = 'webkitMatchesSelector';
+ }
// Why the call to hideNode()?
// Not all target nodes have necessarily been force-hidden,
@@ -699,7 +708,7 @@ var cosmeticFilterMapper = (function() {
var selector, nodes, j, node;
while ( i-- ) {
selector = selectors[i];
- if ( filterMap.has(rootNode) === false && rootNode.matches(selector) ) {
+ if ( filterMap.has(rootNode) === false && rootNode[matchesFnName](selector) ) {
filterMap.set(rootNode, selector);
hideNode(node);
}