Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Unify the means of detecting a window across the library. Fixes jQuer…
…y UI bug #5438 and jQuery bugs #6575 and 6088.
- Loading branch information
Showing
4 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -474,6 +474,11 @@ jQuery.extend({ | ||
return jQuery.type(obj) === "array"; | ||
}, | ||
|
||
// A crude way of determining if an object is a window | ||
isWindow: function( obj ) { | ||
return "setInterval" in obj; | ||
This comment has been minimized.
This comment has been minimized.
mitsuhiko
|
||
}, | ||
|
||
type: function( obj ) { | ||
return obj == null ? | ||
String( obj ) : | ||
@@ -484,7 +489,7 @@ jQuery.extend({ | ||
// Must be an Object. | ||
// Because of IE, we also have to check the presence of the constructor property. | ||
// Make sure that DOM nodes and window objects don't pass through, as well | ||
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || obj.setInterval ) { | ||
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | ||
return false; | ||
} | ||
|
||
@@ -632,7 +637,7 @@ jQuery.extend({ | ||
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 | ||
var type = jQuery.type(array); | ||
|
||
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || "setInterval" in array ) { | ||
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { | ||
push.call( ret, array ); | ||
} else { | ||
jQuery.merge( ret, array ); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return this == window;