fix(foreach): change foreach to support NamedNodeMap

Request Type: bug

How to reproduce: The Caja browser does not expose numeric accessors on Element.attributes, only the NamedNodeMap interface, so Element.attributes fails to pass isArrayLike and thus no appElement is ever set.

https://code.google.com/p/google-caja/issues/detail?id=1905

Component(s): 

Impact: small

Complexity: small

This issue is related to: 

**Detailed Description:**

Most but not all browsers (e.g. Caja) make Element.attributes pass the isArrayLike() test, which is why this bug was not caught earlier.

**Other Comments:**