fixed functionality of unregister() function, added ability to pass null value for obj. Added tests.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@870 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -115,9 +115,12 @@ OpenLayers.Events.prototype = {
|
||||
* @param {Function} func
|
||||
*/
|
||||
unregister: function (type, obj, func) {
|
||||
if (obj == null) {
|
||||
obj = this.object;
|
||||
}
|
||||
var listeners = this.listeners[type];
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
if (listeners[i].obj == obj && listeners[i].type == type) {
|
||||
if (listeners[i].obj == obj && listeners[i].func == func) {
|
||||
listeners.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user