// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
}
Here is how it works:
1. it detects if there is an object being returned
2. it detects if the object type is object
3. it sees if setInterval is a method of the object, setInterval is part of window.setInterval, it’s a method that’s only available in window object.
jQuery.isWindow
最新推荐文章于 2023-07-18 15:40:14 发布
