mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(jqLite): forgive unregistration of a non-registered handler
This commit is contained in:
parent
ad2b8c5bd4
commit
ab59cc6c44
2 changed files with 7 additions and 1 deletions
|
|
@ -212,7 +212,7 @@ function JQLiteOff(element, type, fn) {
|
|||
removeEventListenerFn(element, type, events[type]);
|
||||
delete events[type];
|
||||
} else {
|
||||
arrayRemove(events[type], fn);
|
||||
arrayRemove(events[type] || [], fn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -890,6 +890,12 @@ describe('jqLite', function() {
|
|||
aElem.off('click', function() {});
|
||||
});
|
||||
|
||||
it('should do nothing when a specific listener was not registered', function () {
|
||||
var aElem = jqLite(a);
|
||||
aElem.on('click', function() {});
|
||||
|
||||
aElem.off('mouseenter', function() {});
|
||||
});
|
||||
|
||||
it('should deregister all listeners', function() {
|
||||
var aElem = jqLite(a),
|
||||
|
|
|
|||
Loading…
Reference in a new issue