jQuery function source code -
jquery 1.4.2 in ie 8
when call $.isfunction(function() {})
returns true
.
source code isfunction
function:
isfunction: function (obj) { return tostring.call(obj) === "[object function]"; },
when write in console tostring.call(function() {}) === "[object function]"
throws "object doesn't support property or method"
.
source code of minified version:
isfunction:function(a){return $.call(a)==="[object function]"}
when write in console $.call(function() {})==="[object function]"
returns false
.
why code works in different ways?
at top of jquery 1.4.2 source (inside wrapper), tostring
defined object.prototype.tostring
. global tostring
function different prototyped tostring
method, hencethe different results.
// save reference core methods tostring = object.prototype.tostring,
Comments
Post a Comment