maxtaco/tamejs — pull request #40 by zamfi (2013-05-22 01:33:49+00:00)
Title: A fix for tamejs to coexist with other code that modifies Array.prototype

Using the `for...in` construction to iterate over array objects in JavaScript results in unexpected behavior if Array.prototype is ever changed.

For example:
```javascript
Array.prototype.unique = function() { /* code */ }
var a = [1,2,3];

for (var i in a) {
console.log(i);
}
```
yields
> 1
> 2
> 3
> unique

This is problematic when code assumes that all the values returned by a `for...in` construction will be of a single type because, well, that's what the array has in it.

Fortunately, there's a simple, if inelegant, solution: add the line
```javascript
if (! a.hasOwnProperty(i)) { continue; }
```
to the beginning of each `for...in` block, with the appropriate variable substitutions.

This pull request makes that change.