//7.function isArraylike( ) {} 類似數組的判斷(內部使用)
function isArraylike(obj){
var length = obj.length,
type = jQuery.type(obj);
//jQuery.isWindow()函數用於判斷指定參數是否是一個窗口
if(jQuery.isWindow(obj)){
return false;
}
if(obj.nodeType ===1 && length){
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
//7.function isArraylike( ) {} 類似數組的判斷(內部使用)
//通過jQuery選擇document元素賦給rootjQuery,rootjQuery就是document。
//這樣做有利於壓縮以及代碼的易讀性(通常我們習慣將一個值其賦給一個變量)。
rootjQuery = jQuery(document);