Unify the means of detecting a window across the library. Fixes jQuery UI bug #5438...
[jquery.git] / src / event.js
index 169760a..e63b9c0 100644 (file)
@@ -25,7 +25,7 @@ jQuery.event = {
 
                // For whatever reason, IE has trouble passing the window object
                // around, causing it to be cloned in the process
-               if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
+               if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
                        elem = window;
                }
 
@@ -515,7 +515,7 @@ jQuery.event = {
                beforeunload: {
                        setup: function( data, namespaces, eventHandle ) {
                                // We only want to do this special case on windows
-                               if ( this.setInterval ) {
+                               if ( jQuery.isWindow( this ) ) {
                                        this.onbeforeunload = eventHandle;
                                }
                        },