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

Commit

Permalink
Only setAttribute on an element node
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
dfreedm committed Aug 4, 2014
1 parent 6812fbb commit 810c589
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,20 @@
// TODO(dfreedm): re-evaluate bookkeeping to avoid using attributes
if (recognizer) {
var touchAction = recognizer.defaultActions && recognizer.defaultActions[gesture];
if (touchAction && !node.hasAttribute('touch-action')) {
node.setAttribute('touch-action', touchAction);
var actionNode;
switch(node.nodeType) {
case Node.ELEMENT_NODE:
actionNode = node;
break;
case Node.DOCUMENT_FRAGMENT_NODE:
actionNode = node.host;
break;
default:
actionNode = null;
break;
}
if (touchAction && actionNode && !actionNode.hasAttribute('touch-action')) {
actionNode.setAttribute('touch-action', touchAction);
}
}
node._pgListeners++;
Expand Down

0 comments on commit 810c589

Please sign in to comment.