MooTools adds a bunch of functions to Array.prototype
without preventing them from being enumerated. This means they show up in for-in
loops on arrays.
It would appear that the Panoramio JavaScript is using for..in
on an array without allowing for this, because the error message contains the source of the associate
function that MooTools adds:
// (Result of `String(Array.prototype.associate)` when MooTools is loaded
function (keys){
var obj = {}, length = Math.min(this.length, keys.length);
for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
return obj;
}
This is a bug in the Panoramio script, one should never use for..in
to loop over an array without correct safeguards. See Myths and realities of for..in
(from my blog). If you can get an uncompressed version of the Panoramio script, you can probably fix the relevant loop(s).
Some would also argue that it's a bug (or at least, a bad design decision) for MooTools to add enumerable properties to Array.prototype
.
Dimitar Christoff notes in the comments (thanks Dimitar!) that if you load the Panoramio script after loading MooTools, it works: http://jsfiddle.net/DEWvZ/2/ But beware that if you make any calls into Panoramio later, once MooTools is loaded, those could fail, because if they've made the mistake in one place (initialization), they're likely to make it elsewhere as well.