function isArrayLike( obj ) { // Support: real iOS 8.2 only (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length,
type = toType( obj ); if ( isFunction( obj ) || isWindow( obj ) ) { return false;
} return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}那位朋友可幫忙看下注釋是什么意思?難道這個函數(shù)只支持 iOS 8.2?還有就是,這個是jQuery版本3.0之后的,把針對nodelist的判斷給去除了 if ( obj.nodeType === 1 && length ) { return true;
}這個代碼去掉了
jQuery 中的 isArrayLike函數(shù)問題
瀟瀟雨雨
2019-02-05 19:59:50