New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

migi-fastclick

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

migi-fastclick - npm Package Compare versions

Comparing version

to
1.0.10

28

lib/fastclick.js

@@ -637,2 +637,6 @@ ;(function () {

if (this.targetElement.nodeName.toLowerCase() == 'canvas') {
return true;
}
if (event.forwardedTouchEvent) {

@@ -682,2 +686,26 @@ return true;

FastClick.prototype.onClick = function(event) {
/**
* 当阻止事件冒泡来模拟shadowDom时,fastclick会调用2次,1为默认的body,2为本shadowDom
* 如此捕获阶段便会触发2次,1为默认的body,2为本shadowDom,且并无大碍
* 但会发生点透现象,在2次捕获回调后、冒泡回调、再发生原生的click,原生捕获回调触发在body上
* 此时有个特点,既无this.targetElement,event又无forwardedTouchEvent
* 没有this.targetElement是因为shadowDom阻止了冒泡
* 没有forwardedTouchEvent是因为这是个原生的重复发生的点击
* 此时可以进行this.onMouse中的stopImmediatePropagation()操作
* 如此便可防止点透
*/
if(!this.targetElement && !event.forwardedTouchEvent) {
// Prevent any user-added listeners declared on FastClick element from being fired.
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation();
} else {
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
event.propagationStopped = true;
}
// Cancel the event
event.stopPropagation();
event.preventDefault();
return false;
}
var permitted;

@@ -684,0 +712,0 @@

2

package.json
{
"name": "migi-fastclick",
"version": "1.0.8",
"version": "1.0.10",
"description": "Polyfill to remove click delays on browsers with touch UIs.",

@@ -5,0 +5,0 @@ "maintainers": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet