[JS] Fixed instanceof for native functions

As part of the ES5 spec (http://ecma262-5.com/ELS5_HTML.htm#Section_11.4.3), native functions return "object" when typeof is called on them. Chrome, Firefox, Opera implement the spec incorrectly and return "function" so there are no problems, but at least iOS Safari (possibly desktop Safari) implement the spec correctly and return "object". This leads to cast throwing errors if you are working with native DOM objects.

<!---
@huboard:{"order":2263.46875}
-->