update triggerEvent() so that it doesnt bomb if user tries to trigger a non-enabled event. Added thorough testing.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@875 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -158,15 +158,22 @@ OpenLayers.Events.prototype = {
|
||||
|
||||
// execute all callbacks registered for specified type
|
||||
var listeners = this.listeners[type];
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
var callback = listeners[i];
|
||||
|
||||
// use the 'call' method to bind the context to callback.obj
|
||||
var continueChain = callback.func.call(callback.obj, evt);
|
||||
|
||||
if ((continueChain != null) && (continueChain == false)) {
|
||||
// if callback returns false, execute no more callbacks.
|
||||
break;
|
||||
if (listeners != null) {
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
var callback = listeners[i];
|
||||
var continueChain;
|
||||
if (callback.obj != null) {
|
||||
// use the 'call' method to bind the context to callback.obj
|
||||
continueChain = callback.func.call(callback.obj, evt);
|
||||
} else {
|
||||
continueChain = callback.func(evt);
|
||||
}
|
||||
|
||||
if ((continueChain != null) && (continueChain == false)) {
|
||||
// if callback returns false, execute no more callbacks.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user