|
41 | 41 | // Check for touch-only devices
|
42 | 42 | var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
|
43 | 43 |
|
44 |
| - // Check for sourceCapabilities, used to distinguish synthetic events |
45 |
| - var HAS_SOURCE_CAPS = 'sourceCapabilities' in UIEvent.prototype; |
46 |
| - |
47 | 44 | // touch will make synthetic mouse events
|
48 | 45 | // `preventDefault` on touchend will cancel them,
|
49 | 46 | // but this breaks `<input>` focus and link clicks
|
50 | 47 | // disable mouse handlers for MOUSE_TIMEOUT ms after
|
51 | 48 | // a touchend to ignore synthetic mouse events
|
52 | 49 | var mouseCanceller = function(mouseEvent) {
|
53 |
| - if (HAS_SOURCE_CAPS) { |
54 |
| - // if mouseEvent did not come from a device that fires touch events, |
55 |
| - // it was made by a real mouse and should be counted |
56 |
| - // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents |
57 |
| - var sc = mouseEvent.sourceCapabilities; |
58 |
| - if (sc && !sc.firesTouchEvents) { |
59 |
| - return; |
60 |
| - } |
| 50 | + // Check for sourceCapabilities, used to distinguish synthetic events |
| 51 | + // if mouseEvent did not come from a device that fires touch events, |
| 52 | + // it was made by a real mouse and should be counted |
| 53 | + // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents |
| 54 | + var sc = mouseEvent.sourceCapabilities; |
| 55 | + if (sc && !sc.firesTouchEvents) { |
| 56 | + return; |
61 | 57 | }
|
62 | 58 | // skip synthetic mouse events
|
63 | 59 | mouseEvent[HANDLED_OBJ] = {skip: true};
|
|
0 commit comments