|
194 | 194 | touchHandled = false;
|
195 | 195 | };
|
196 | 196 |
|
| 197 | + let _touchStartBound = mouseProto._touchStart.bind(mouseProto), |
| 198 | + _touchMoveBound = mouseProto._touchMove.bind(mouseProto), |
| 199 | + _touchEndBound = mouseProto._touchEndBound.bind(mouseProto); |
| 200 | + |
197 | 201 | /**
|
198 | 202 | * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
|
199 | 203 | * This method extends the widget with bound touch event handlers that
|
|
210 | 214 | }
|
211 | 215 |
|
212 | 216 | // Delegate the touch handlers to the widget's element
|
213 |
| - self.element.bind( |
214 |
| - {'touchstart': mouseProto._touchStart}, |
215 |
| - {'touchmove': mouseProto._touchMove}, |
216 |
| - {'touchend': mouseProto._touchEnd} |
217 |
| - ); |
| 217 | + self.element.on({ |
| 218 | + touchstart: _touchStartBound, |
| 219 | + touchmove: _touchMoveBound, |
| 220 | + touchend: _touchEndBound |
| 221 | + }); |
218 | 222 |
|
219 | 223 | // Call the original $.ui.mouse init method
|
220 | 224 | _mouseInit.call(self);
|
|
228 | 232 | let self = this;
|
229 | 233 |
|
230 | 234 | // Delegate the touch handlers to the widget's element
|
231 |
| - self.element.unbind( |
232 |
| - {'touchstart': mouseProto._touchStart}, |
233 |
| - {'touchmove': mouseProto._touchMove}, |
234 |
| - {'touchend': mouseProto._touchEnd} |
235 |
| - ); |
| 235 | + self.element.off({ |
| 236 | + touchstart: _touchStartBound, |
| 237 | + touchmove: _touchMoveBound, |
| 238 | + touchend: _touchEndBound |
| 239 | + }); |
236 | 240 |
|
237 | 241 | // Call the original $.ui.mouse destroy method
|
238 | 242 | _mouseDestroy.call(self);
|
|
0 commit comments