be ready for when Element.matches is not supported

This commit is contained in:
gorhill 2015-03-16 15:07:24 -04:00
parent 865ff3e01b
commit d098edf2e3
1 changed files with 8 additions and 0 deletions

View File

@ -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; }
};
}
};
/******************************************************************************/