Permalink
Browse files

Fixed unbinding of delegated events via on().

Ammended tests to use correct syntax.
  • Loading branch information...
1 parent b71e8b8 commit 069482ff78609cdc70d002d62575669e5b0317b2 @nelsonmenezes nelsonmenezes committed Feb 28, 2013
Showing with 7 additions and 7 deletions.
  1. +1 −1 src/jquip.events.js
  2. +6 −6 test/spec/events.js
View
@@ -132,7 +132,7 @@ $['plug']("events", function($){
};
p['off'] = function(evt, sel, cb){
- return typeof sel === 'string' ? this.undelegate(evt, sel, cb) : this.unbind(evt, cb);
+ return typeof sel === 'string' ? this.undelegate(sel, evt, cb) : this.unbind(evt, cb);
};
p['trigger'] = function (evt) {
return this['each'](function () {
View
@@ -122,7 +122,7 @@
var spy = jasmine.createSpy('cb'),
inner = $('<span>').appendTo(el);
- el.on('span', 'click', spy);
+ el.on('click', 'span', spy);
inner.click();
expect(spy).toHaveBeenCalled();
@@ -132,8 +132,8 @@
var spy = jasmine.createSpy('cb'),
inner = $('<span>').appendTo(el);
- el.on('span', 'click', spy);
- el.off('span', 'click', spy);
+ el.on('click', 'span', spy);
+ el.off('click', 'span', spy);
inner.click();
expect(spy).not.toHaveBeenCalled();
@@ -144,10 +144,10 @@
spy2 = jasmine.createSpy('cb2'),
inner = $('<span>').appendTo(el);
- el.on('span', 'click', spy);
- el.on('span', 'click', spy2);
+ el.on('click', 'span', spy);
+ el.on('click', 'span', spy2);
- el.off('span', 'click');
+ el.off('click', 'span');
inner.click();
expect(spy).not.toHaveBeenCalled();

0 comments on commit 069482f

Please sign in to comment.