#837 - modify Util.extend to deal with custom toString property - IE doesn't iterate over toString, this patch fixes this behavior for Util.extend
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3760 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,12 +36,30 @@ if ($ == null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: extend
|
||||
* From Prototype.js
|
||||
* APIFunction: extend
|
||||
* Copy all properties of a source object to a destination object. Modifies
|
||||
* the passed in 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) {
|
||||
for (property in source) {
|
||||
destination[property] = source[property];
|
||||
if(destination && source) {
|
||||
for(property in source) {
|
||||
destination[property] = source[property];
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
if(source.hasOwnProperty && source.hasOwnProperty('toString')) {
|
||||
destination.toString = source.toString;
|
||||
}
|
||||
}
|
||||
return destination;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user