87,909
社区成员
发帖
与我相关
我的任务
分享
jQuery.fn = jQuery.prototype = {
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
jq对象本身是个Object,添加了Array的专有方法后,就变得像数组了,看上去就是Object[length],多么像数组啊!!!
嗯。。就是这么回事。
That's all.
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
console.log( this instanceof jQuery ); // return true
console.log( this instanceof Object ); // return true
// Handle $(""), $(null), $(undefined), $(false)