MCPcopy Create free account
hub / github.com/Famous/famous-angular / onClick

Function onClick

src/scripts/directives/fa-input.js:99–124  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

97 // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick
98 // was called recently.
99 function onClick(event) {
100 if (Date.now() - lastPreventedTime > PREVENT_DURATION) {
101 return; // Too old.
102 }
103
104 var touches = event.touches && event.touches.length ? event.touches : [event];
105 var x = touches[0].clientX;
106 var y = touches[0].clientY;
107
108
109 // Look for an allowable region containing this click.
110 // If we find one, that means it was created by touchstart and not removed by
111 // preventGhostClick, so we don't bust it.
112 if (checkAllowableRegions(touchCoordinates, x, y)) {
113 return;
114 }
115
116 // If we didn't find an allowable region, bust the click.
117 event.stopPropagation();
118 event.preventDefault();
119
120 // Blur focused form elements
121 if(event.target) {
122 event.target.blur();
123 }
124 }
125
126
127 // Global touchstart handler that creates an allowable region for a click event.

Callers

nothing calls this directly

Calls 1

checkAllowableRegionsFunction · 0.85

Tested by

no test coverage detected