Fixed the issue with jQuery conflicting with windows/IFrames.
[jquery.git] / src / jquery / jquery.js
index 35a6ceb..93ebe20 100644 (file)
@@ -56,7 +56,7 @@ var jQuery = function(a,c) {
        }
 
        // Watch for when an array is passed in
-       this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
+       this.get( a.constructor == Array || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType ?
                // Assume that it is an array of DOM Elements
                jQuery.merge( a, [] ) :
 
@@ -944,12 +944,15 @@ jQuery.fn = jQuery.prototype = {
         * @result $("p").find("span").end() == [ <p>...</p> ]
         *
         * @test ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
+        * ok( $('#yahoo').end(), 'Check for end with nothing to end' );
         *
         * @name end
         * @type jQuery
         * @cat DOM/Traversing
         */
        end: function() {
+               if( !(this.stack && this.stack.length) )
+                       return this;
                return this.get( this.stack.pop() );
        },