Ticket #4536 (closed enhancement: wontfix)
jQuery.isFunction fix for built-in IE functions
|Reported by:||leidegre||Owned by:|
I found some background information on the typeof built-in DOM function problem in IE, and there's a plausible workaround for this.
The typeof these functions is "object", but the toString representation for IE is "\nfunction..." which a simple regular expression could catch. e.g.
// where this.context == <form/> alert(^function/m.test(""+this.context.reset)); // true!
The multiline flag is necessary becuase IE adds a new line just before the "function" keyword.
If the typeof is not "object", then the above does not apply, so, any malformed string can not evaluate as a "function". But an object, where the toString function returns a string that starts with "function" would. Maybe there's a workaround for that to, but this slight modification of the jQuery.isFunction function does make it a lot more useful (compatibility wise).