Removing the OpenLayers.Util.extend method to the Class.js file to avoid a circular dependency that cannot be resolved with an arbitrary sort order. r=elemoine (closes #2992)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11003 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -106,3 +106,50 @@ OpenLayers.inherit = function(C, P) {
|
|||||||
OpenLayers.Util.extend(C.prototype, o);
|
OpenLayers.Util.extend(C.prototype, o);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIFunction: extend
|
||||||
|
* Copy all properties of a source object to a destination object. Modifies
|
||||||
|
* the passed in destination object. Any properties on the source object
|
||||||
|
* that are set to undefined will not be (re)set on the destination object.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* destination - {Object} The object that will be modified
|
||||||
|
* source - {Object} The object with properties to be set on the destination
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Object} The destination object.
|
||||||
|
*/
|
||||||
|
OpenLayers.Util = OpenLayers.Util || {};
|
||||||
|
OpenLayers.Util.extend = function(destination, source) {
|
||||||
|
destination = destination || {};
|
||||||
|
if (source) {
|
||||||
|
for (var property in source) {
|
||||||
|
var value = source[property];
|
||||||
|
if (value !== undefined) {
|
||||||
|
destination[property] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IE doesn't include the toString property when iterating over an object's
|
||||||
|
* properties with the for(property in object) syntax. Explicitly check if
|
||||||
|
* the source has its own toString property.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
|
||||||
|
* prototype object" when calling hawOwnProperty if the source object
|
||||||
|
* is an instance of window.Event.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var sourceIsEvt = typeof window.Event == "function"
|
||||||
|
&& source instanceof window.Event;
|
||||||
|
|
||||||
|
if (!sourceIsEvt
|
||||||
|
&& source.hasOwnProperty && source.hasOwnProperty("toString")) {
|
||||||
|
destination.toString = source.toString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return destination;
|
||||||
|
};
|
||||||
|
|||||||
+1
-48
@@ -11,7 +11,7 @@
|
|||||||
/**
|
/**
|
||||||
* Namespace: Util
|
* Namespace: Util
|
||||||
*/
|
*/
|
||||||
OpenLayers.Util = {};
|
OpenLayers.Util = OpenLayers.Util || {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: getElement
|
* Function: getElement
|
||||||
@@ -54,53 +54,6 @@ if(typeof window.$ === "undefined") {
|
|||||||
window.$ = OpenLayers.Util.getElement;
|
window.$ = OpenLayers.Util.getElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* APIFunction: extend
|
|
||||||
* Copy all properties of a source object to a destination object. Modifies
|
|
||||||
* the passed in destination object. Any properties on the source object
|
|
||||||
* that are set to undefined will not be (re)set on the destination object.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* destination - {Object} The object that will be modified
|
|
||||||
* source - {Object} The object with properties to be set on the destination
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* {Object} The destination object.
|
|
||||||
*/
|
|
||||||
OpenLayers.Util.extend = function(destination, source) {
|
|
||||||
destination = destination || {};
|
|
||||||
if(source) {
|
|
||||||
for(var property in source) {
|
|
||||||
var value = source[property];
|
|
||||||
if(value !== undefined) {
|
|
||||||
destination[property] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IE doesn't include the toString property when iterating over an object's
|
|
||||||
* properties with the for(property in object) syntax. Explicitly check if
|
|
||||||
* the source has its own toString property.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
|
|
||||||
* prototype object" when calling hawOwnProperty if the source object
|
|
||||||
* is an instance of window.Event.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var sourceIsEvt = typeof window.Event == "function"
|
|
||||||
&& source instanceof window.Event;
|
|
||||||
|
|
||||||
if(!sourceIsEvt
|
|
||||||
&& source.hasOwnProperty && source.hasOwnProperty('toString')) {
|
|
||||||
destination.toString = source.toString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return destination;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: removeItem
|
* Function: removeItem
|
||||||
* Remove an object from an array. Iterates through the array
|
* Remove an object from an array. Iterates through the array
|
||||||
|
|||||||
Reference in New Issue
Block a user