Use a cross-frame compatible instanceof check - Closes #2172.

Also see
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write
-a-robust-isarray/