Protect against libraries that extend Array.prototype

for (var ... in ...) loops should always check if the property being iterated isn't borrowed from somewhere else.
In this particular case, the code breaks if used in the same environment as old versions of PrototypeJS.