More robust array type check. p=mwootendev, r=me (closes #2959)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12095 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -131,7 +131,7 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
|
||||
* components - {Array(<OpenLayers.Geometry>)} An array of geometries to add
|
||||
*/
|
||||
addComponents: function(components){
|
||||
if(!(components instanceof Array)) {
|
||||
if(!(OpenLayers.Util.isArray(components))) {
|
||||
components = [components];
|
||||
}
|
||||
for(var i=0, len=components.length; i<len; i++) {
|
||||
@@ -185,7 +185,7 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
|
||||
* components - {Array(<OpenLayers.Geometry>)} The components to be removed
|
||||
*/
|
||||
removeComponents: function(components) {
|
||||
if(!(components instanceof Array)) {
|
||||
if(!(OpenLayers.Util.isArray(components))) {
|
||||
components = [components];
|
||||
}
|
||||
for(var i=components.length-1; i>=0; --i) {
|
||||
@@ -468,7 +468,7 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
|
||||
if(!geometry || !geometry.CLASS_NAME ||
|
||||
(this.CLASS_NAME != geometry.CLASS_NAME)) {
|
||||
equivalent = false;
|
||||
} else if(!(geometry.components instanceof Array) ||
|
||||
} else if(!(OpenLayers.Util.isArray(geometry.components)) ||
|
||||
(geometry.components.length != this.components.length)) {
|
||||
equivalent = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user