jQuery 1.4 Source code 449 lines (core.js 431 lines), the method to determine whether it is a function is as follows (the idea comes from Douglas Crockford "The Miller Device" by ):
<code><span class="pln">isFunction</span><span class="pun"><font color="#666600">:</font></span><span class="pln"> </span><span class="kwd"><font color="#000088">function</font></span><span class="pun"><font color="#666600">(</font></span><span class="pln"> obj </span><span class="pun"><font color="#666600">)</font></span><span class="pln"> </span><span class="pun"><font color="#666600">{</font></span><span class="pln"><br> </span><span class="kwd"><font color="#000088">return</font></span><span class="pln"> </span><span class="kwd"><font color="#000088">toString</font></span><span class="pun"><font color="#666600">.</font></span><span class="pln">call</span><span class="pun"><font color="#666600">(</font></span><span class="pln">obj</span><span class="pun"><font color="#666600">)</font></span><span class="pln"> </span><span class="pun"><font color="#666600">===</font></span><span class="pln"> </span><span class="str"><font color="#008800">"[object Function]"</font></span><span class="pun"><font color="#666600">;</font></span><span class="pln"><br></span><span class="pun"><font color="#666600">},</font></span></code>
At the same time, the author of jQuery also made some comments:
See test/unit/core.js for details concerning isFunction. Since version 1.3, DOM methods and functions like alert aren't supported. They return false on IE (#2968).
That is: this method cannot correctly identify DOM methods and some functions (such as alert methods, etc.) under IE.
Why is this happening?