Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(jqLite): forgive unregistration of a non-registered handler
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Aug 7, 2013
1 parent c18074a commit ac5b905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function JQLiteUnbind(element, type, fn) {
removeEventListenerFn(element, type, events[type]);
delete events[type];
} else {
arrayRemove(events[type], fn);
arrayRemove(events[type] || [], fn);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/jqLiteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,12 @@ describe('jqLite', function() {
aElem.unbind('click', function() {});
});

it('should do nothing when a specific listener was not registered', function () {
var aElem = jqLite(a);
aElem.bind('click', function() {});

aElem.unbind('mouseenter', function() {});
});

it('should deregister all listeners', function() {
var aElem = jqLite(a),
Expand Down

0 comments on commit ac5b905

Please sign in to comment.