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

Also see
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write
-a-robust-isarray/
Ignore events not triggered by the widget listeners. Fixes #2177.
Removed unecessary argument. Closes #2178.