Permalink
Browse files

Fix bug where target returns null when touching outside the viewport.

  • Loading branch information...
1 parent 08e844d commit 4d5b0bbb76823a1f66e03b11bc9e7c6adead5fe0 @cheeaun committed Oct 17, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 source/tappable.js
View
@@ -51,7 +51,7 @@ var tappable = function(el, opts){
clientY = changedTouches.clientY,
target = document.elementFromPoint(clientX, clientY);
if (!e.target) e.target = target;
- if (target.nodeType == 3) target = target.parentNode;
+ if (target && target.nodeType == 3) target = target.parentNode;
if (noScroll){
if (target != el){
@@ -78,7 +78,7 @@ var tappable = function(el, opts){
var target = document.elementFromPoint(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
if (!e.target) e.target = target;
- if (target.nodeType == 3) target = target.parentNode;
+ if (target && target.nodeType == 3) target = target.parentNode;
options.onEnd.call(el, e, target);

0 comments on commit 4d5b0bb

Please sign in to comment.