Skip to content

Commit

Permalink
Event name is not always provided which may cause errors, fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
silverkorn committed Jan 13, 2015
1 parent 708ba77 commit bb2e6b2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/touche.js
Expand Up @@ -71,18 +71,22 @@

// Change event type and re-apply .on() method
jQuery.fn.on = function() {
// arguments[0] is the event name
arguments[0] = replaceEventName(arguments[0]);

// arguments[0] is the event name if provided
if(typeof arguments[0] === "string"){
arguments[0] = replaceEventName(arguments[0]);
}

originalOnMethod.apply(this, arguments);
return this;
};

// Change event type and re-apply .off() method
jQuery.fn.off = function() {
// arguments[0] is the event name
arguments[0] = replaceEventName(arguments[0]);

// arguments[0] is the event name if provided
if(typeof arguments[0] === "string"){
arguments[0] = replaceEventName(arguments[0]);
}

originalOffMethod.apply(this, arguments);
return this;
};
Expand Down

0 comments on commit bb2e6b2

Please sign in to comment.