[GrabToPan] Use Element.matches() rather than prefixed ...matchesSelector versions
				
					
				
			At this point in time all of the browsers that PDF.js support now implements, with some margin based on the version numbers, `Element.matches()` according to the following compatibility information: - https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#browser_compatibility - https://caniuse.com/matchesselector
This commit is contained in:
		
							parent
							
								
									ebd2dfbae0
								
							
						
					
					
						commit
						b11b7aaa38
					
				| @ -95,9 +95,8 @@ GrabToPan.prototype = { | |||||||
|    * @returns {boolean} Whether to not react to the click event. |    * @returns {boolean} Whether to not react to the click event. | ||||||
|    */ |    */ | ||||||
|   ignoreTarget: function GrabToPan_ignoreTarget(node) { |   ignoreTarget: function GrabToPan_ignoreTarget(node) { | ||||||
|     // Use matchesSelector to check whether the clicked element
 |     // Check whether the clicked element is, a child of, an input element/link.
 | ||||||
|     // is (a child of) an input element / link
 |     return node.matches( | ||||||
|     return node[matchesSelector]( |  | ||||||
|       "a[href], a[href] *, input, textarea, button, button *, select, option" |       "a[href], a[href] *, input, textarea, button, button *, select, option" | ||||||
|     ); |     ); | ||||||
|   }, |   }, | ||||||
| @ -178,20 +177,6 @@ GrabToPan.prototype = { | |||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| // Get the correct (vendor-prefixed) name of the matches method.
 |  | ||||||
| let matchesSelector; |  | ||||||
| ["webkitM", "mozM", "m"].some(function (prefix) { |  | ||||||
|   let name = prefix + "atches"; |  | ||||||
|   if (name in document.documentElement) { |  | ||||||
|     matchesSelector = name; |  | ||||||
|   } |  | ||||||
|   name += "Selector"; |  | ||||||
|   if (name in document.documentElement) { |  | ||||||
|     matchesSelector = name; |  | ||||||
|   } |  | ||||||
|   return matchesSelector; // If found, then truthy, and [].some() ends.
 |  | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| /** | /** | ||||||
|  * Whether the left mouse is not pressed. |  * Whether the left mouse is not pressed. | ||||||
|  * @param event {MouseEvent} |  * @param event {MouseEvent} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user