changing functionality of Events.register(). Now if a null callback is passed in, no action is taken. If a null *obj* is passed in, however, the obj used is this.object (the Events Object's related object). Added tests to make sure this works.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@869 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -77,8 +77,11 @@ OpenLayers.Events.prototype = {
|
||||
|
||||
/**
|
||||
* @param {String} type Name of the event to register
|
||||
* @param {Object} obj The object to bind the context to for the callback#
|
||||
* @param {Function} func The callback function
|
||||
* @param {Object} obj The object to bind the context to for the callback#.
|
||||
* If no object is specified, default is the Events's
|
||||
* 'object' property.
|
||||
* @param {Function} func The callback function. If no callback is
|
||||
* specified, this function does nothing.
|
||||
*
|
||||
* #When the event is triggered, the 'func' function will be called, in the
|
||||
* context of 'obj'. Imagine we were to register an event, specifying an
|
||||
@@ -96,12 +99,14 @@ OpenLayers.Events.prototype = {
|
||||
*
|
||||
*/
|
||||
register: function (type, obj, func) {
|
||||
if (func == null) {
|
||||
obj = this.object;
|
||||
func = obj;
|
||||
|
||||
if (func != null) {
|
||||
if (obj == null) {
|
||||
obj = this.object;
|
||||
}
|
||||
var listeners = this.listeners[type];
|
||||
listeners.push( {obj: obj, func: func} );
|
||||
}
|
||||
var listeners = this.listeners[type];
|
||||
listeners.push( {obj: obj, func: func} );
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user