mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-14 01:33:11 +00:00
fix(jqLite): forgive unregistration of a non-registered handler
This commit is contained in:
parent
c18074a310
commit
ac5b9055f6
2 changed files with 7 additions and 1 deletions
|
|
@ -205,7 +205,7 @@ function JQLiteUnbind(element, type, fn) {
|
||||||
removeEventListenerFn(element, type, events[type]);
|
removeEventListenerFn(element, type, events[type]);
|
||||||
delete events[type];
|
delete events[type];
|
||||||
} else {
|
} else {
|
||||||
arrayRemove(events[type], fn);
|
arrayRemove(events[type] || [], fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -843,6 +843,12 @@ describe('jqLite', function() {
|
||||||
aElem.unbind('click', 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() {
|
it('should deregister all listeners', function() {
|
||||||
var aElem = jqLite(a),
|
var aElem = jqLite(a),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue