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:
euzuro
2006-07-04 13:54:04 +00:00
parent 91f17f20ff
commit 076632122b
2 changed files with 49 additions and 10 deletions
+16 -9
View File
@@ -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;
}
}
}
},