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:
@@ -58,6 +58,22 @@ OpenLayers.Util.isElement = function(o) {
|
||||
return !!(o && o.nodeType === 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: isArray
|
||||
* Tests that the provided object is an array.
|
||||
* This test handles the cross-IFRAME case not caught
|
||||
* by "a instanceof Array" and should be used instead.
|
||||
*
|
||||
* Parameters:
|
||||
* a - {Object} the object test.
|
||||
*
|
||||
* Returns
|
||||
* {Boolean} true if the object is an array.
|
||||
*/
|
||||
OpenLayers.Util.isArray = function(a) {
|
||||
return (Object.prototype.toString.call(a) === '[object Array]');
|
||||
};
|
||||
|
||||
/**
|
||||
* Maintain existing definition of $.
|
||||
*/
|
||||
@@ -346,7 +362,7 @@ OpenLayers.Util.onImageLoadError = function() {
|
||||
this._attempts = (this._attempts) ? (this._attempts + 1) : 1;
|
||||
if (this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
|
||||
var urls = this.urls;
|
||||
if (urls && urls instanceof Array && urls.length > 1){
|
||||
if (urls && OpenLayers.Util.isArray(urls) && urls.length > 1){
|
||||
var src = this.src.toString();
|
||||
var current_url, k;
|
||||
for (k = 0; current_url = urls[k]; k++){
|
||||
|
||||
Reference in New Issue
Block a user