File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -686,6 +686,15 @@ var cosmeticFilterFromTarget = function(nid, coarseSelector) {
686686/******************************************************************************/
687687
688688var cosmeticFilterMapper = ( function ( ) {
689+ // https://github.com/gorhill/uBlock/issues/546
690+ var matchesFnName ;
691+ if ( typeof document . body . matches === 'function' ) {
692+ matchesFnName = 'matches' ;
693+ } else if ( typeof document . body . mozMatchesSelector === 'function' ) {
694+ matchesFnName = 'mozMatchesSelector' ;
695+ } else if ( typeof document . body . webkitMatchesSelector === 'function' ) {
696+ matchesFnName = 'webkitMatchesSelector' ;
697+ }
689698
690699 // Why the call to hideNode()?
691700 // Not all target nodes have necessarily been force-hidden,
@@ -699,7 +708,7 @@ var cosmeticFilterMapper = (function() {
699708 var selector , nodes , j , node ;
700709 while ( i -- ) {
701710 selector = selectors [ i ] ;
702- if ( filterMap . has ( rootNode ) === false && rootNode . matches ( selector ) ) {
711+ if ( filterMap . has ( rootNode ) === false && rootNode [ matchesFnName ] ( selector ) ) {
703712 filterMap . set ( rootNode , selector ) ;
704713 hideNode ( node ) ;
705714 }
You can’t perform that action at this time.
0 commit comments