|
18 | 18 | })();
|
19 | 19 |
|
20 | 20 | // polyfill use to simulate native "tap"
|
21 |
| - ionic.tapElement = function(ele, e) { |
| 21 | + ionic.tapElement = function(target, e) { |
22 | 22 | // simulate a normal click by running the element's click method then focus on it
|
| 23 | + |
| 24 | + var ele = target.control || target; |
| 25 | + |
23 | 26 | if(ele.disabled) return;
|
24 | 27 |
|
25 | 28 | console.debug('tapElement', ele.tagName, ele.className);
|
|
46 | 49 | if( !isRecentTap(e) ) {
|
47 | 50 | recordCoordinates(e);
|
48 | 51 | }
|
| 52 | + |
| 53 | + if(target.control) { |
| 54 | + console.debug('tapElement, target.control, stop'); |
| 55 | + return stopEvent(e); |
| 56 | + } |
49 | 57 | };
|
50 | 58 |
|
51 | 59 | function tapPolyfill(orgEvent) {
|
|
66 | 74 | if( ele.tagName === "INPUT" ||
|
67 | 75 | ele.tagName === "A" ||
|
68 | 76 | ele.tagName === "BUTTON" ||
|
| 77 | + ele.tagName === "LABEL" || |
69 | 78 | ele.tagName === "TEXTAREA" ||
|
70 | 79 | ele.tagName === "SELECT" ) {
|
71 | 80 |
|
72 | 81 | return ionic.tapElement(ele, e);
|
73 |
| - |
74 |
| - } else if( ele.tagName === "LABEL" ) { |
75 |
| - // check if the tapped label has an input associated to it |
76 |
| - if(ele.control) { |
77 |
| - return ionic.tapElement(ele.control, e); |
78 |
| - } |
79 | 82 | }
|
80 | 83 | ele = ele.parentElement;
|
81 | 84 | }
|
|
158 | 161 |
|
159 | 162 | function removeClickPrevent(e) {
|
160 | 163 | setTimeout(function(){
|
161 |
| - if(e.target && e.target.control && e.target.control.labelLastTap) { |
162 |
| - e.target.control.labelLastTap = null; |
163 |
| - } |
164 |
| - var c = isRecentTap(e); |
165 |
| - if(c) delete tapCoordinates[c.id]; |
| 164 | + var tap = isRecentTap(e); |
| 165 | + if(tap) delete tapCoordinates[tap.id]; |
166 | 166 | }, REMOVE_PREVENT_DELAY);
|
167 |
| - return stopEvent(e); |
168 | 167 | }
|
169 | 168 |
|
170 | 169 | function stopEvent(e){
|
|
0 commit comments