mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-13 08:56:40 +08:00
fix(jqLite): forgive unregistration of a non-registered handler
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user