aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-03-16 15:07:24 -0400
committergorhill <rhill@raymondhill.net>2015-03-16 15:07:24 -0400
commitd098edf2e32e58760d54e719e5bd5b6df38e4afa (patch)
treec2ce13a0ec71c4c4ce2a1e6c740f13a1af09c31d
parent865ff3e01b2af054080da78e48450ed1c2ca0a9b (diff)
downloaduBlock-d098edf2e32e58760d54e719e5bd5b6df38e4afa.zip
uBlock-d098edf2e32e58760d54e719e5bd5b6df38e4afa.tar.gz
uBlock-d098edf2e32e58760d54e719e5bd5b6df38e4afa.tar.bz2
be ready for when Element.matches is not supported
-rw-r--r--src/js/cosmetic-filtering.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js
index 3781b6d..4c41950 100644
--- a/src/js/cosmetic-filtering.js
+++ b/src/js/cosmetic-filtering.js
@@ -239,7 +239,15 @@ var FilterParser = function() {
this.invalid = false;
this.cosmetic = true;
this.reParser = /^\s*([^#]*)(##|#@#)(.+)\s*$/;
+
+ // Not all browsers support `Element.matches`:
+ // http://caniuse.com/#feat=matchesselector
this.div = document.createElement('div');
+ if ( typeof this.div.matches !== 'function' ) {
+ this.div = {
+ matches: function() { return true; }
+ };
+ }
};
/******************************************************************************/