Permalink
Browse files

Added jQuery workaround for allowTouchmoveDefaults flag on events. Pu…

…t the property on the originalEvent object if jQuery is in play.
  • Loading branch information...
breeze4 committed Mar 26, 2016
1 parent 06594da commit a3bb0e77c70fa2bac94de7da1f37abbacc1b6740
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/js/core/touchmoveDefaults.js
@@ -47,7 +47,9 @@

module.directive('uiPreventTouchmoveDefaults', function() {
var preventTouchmoveDefaultsCb = function(e) {
if (e.allowTouchmoveDefault !== true) {
// Get this flag from either the saved event if jQuery is being used, otherwise get it from the event itself.
var allowTouchmoveEventFlag = e.originalEvent ? e.originalEvent.allowTouchmoveDefault : e.allowTouchmoveDefault;
if (allowTouchmoveEventFlag !== true) {
e.preventDefault();
}
};
@@ -95,7 +97,11 @@
condition = condition || fnTrue;

var allowTouchmoveDefaultCallback = function(e) {
if (condition(e)) { e.allowTouchmoveDefault = true; }
if (condition(e)) {
e.allowTouchmoveDefault = true;
// jQuery normalizes the event object, need to put this property on the copied originalEvent.
if (e.originalEvent) e.originalEvent.allowTouchmoveDefault = true;
}
};

$element = angular.element($element);

0 comments on commit a3bb0e7

Please sign in to comment.