Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Fix finding targets #48

Closed
wants to merge 1 commit into from
Closed

Conversation

sbmaxx
Copy link
Contributor

@sbmaxx sbmaxx commented Aug 27, 2014

In mobile safari at least on each move action we trying to find touch-action property, but we have error here:

    findTouchAction: function(inEvent) {
      var n;
      if (HAS_FULL_PATH && inEvent.path) {
        var path = inEvent.path;
        for (var i = 0; i < path.length; i++) {
          n = path[i];
          if (n.nodeType === Node.ELEMENT_NODE && n.hasAttribute('touch-action')) {
            return n.getAttribute('touch-action');
          }
        }
      } else {
        n = inEvent.target;
        while(n) {
          if (n.hasAttribute('touch-action')) {
            return n.getAttribute('touch-action');
          }
          n = n.parentNode || n.host;
        }
      }
      // auto is default
      return "auto";
    },

Sometimes n doesn't have method hasAttribute. I did not search for the reason, but for workaround we can add

typeof n.hasAttribute === 'function'

in condition.

I will search for the real issue later.

@dfreedm
Copy link
Contributor

dfreedm commented Sep 23, 2014

I think I fixed this in 8945a0b with n.nodeType === Node.ELEMENT_NODE. All Element nodes must have hasAttribute

@dfreedm dfreedm closed this Sep 23, 2014
@sbmaxx sbmaxx deleted the fixFindTargets branch September 25, 2014 04:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants