Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Prevent touch module from binding the same events twice, delegate $.parseJSON to JSON.parse #537

wants to merge 2 commits into from

2 participants


Trying to resolve issues #535 (#535) and #452 (#452)


When does touch.js get loaded twice? Can't you prevent that in user code?


There is no good reason for it to happen, I just saw the open issue and thought it would be an easy way to stop people from shooting themselves in the foot. I meant to make these as two separate pull requests though, sorry.


You don't have to make your contributions separate pull requests. Just make sure they're separate commits, like you did.

In the end I didn't use any of your commits, however. I didn't want to "patch" touch.js getting double-loaded until we decide that's an issue we want to fix, and your $.parseJSON commit was missing tests so I've just did the change myself: 236bd24

@mislav mislav closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2012
  1. @napoleond
  2. @napoleond
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +2 −0  src/touch.js
  2. +2 −0  src/zepto.js
2  src/touch.js
@@ -3,6 +3,8 @@
// Zepto.js may be freely distributed under the MIT license.
+ if (window.Zepto.fn["swipe"]) return
var touch = {}, touchTimeout
function parentIfText(node){
2  src/zepto.js
@@ -199,6 +199,8 @@ var Zepto = (function() {
function funcArg(context, arg, idx, payload) {
return isFunction(arg) ?, idx, payload) : arg
+ $.parseJSON = JSON.parse
$.isFunction = isFunction
$.isObject = isObject
Something went wrong with that request. Please try again.