Fixed the issue with jQuery conflicting with windows/IFrames.
[jquery.git] / src / jquery / jquery.js
index 996ace8..93ebe20 100644 (file)
@@ -31,7 +31,7 @@ window.undefined = window.undefined;
 var jQuery = function(a,c) {
 
        // Shortcut for document ready (because $(document).each() is silly)
-       if ( a && typeof a == "function" && jQuery.fn.ready )
+       if ( a && typeof a == "function" && jQuery.fn.ready && !a.nodeType && a[0] == undefined ) // Safari reports typeof on DOM NodeLists as a function
                return jQuery(document).ready(a);
 
        // Make sure that a selection was provided
@@ -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() );
        },
 
@@ -1693,10 +1696,6 @@ jQuery.extend({
         * t( "Attribute Exists", "a[@title]", ["google"] );
         * t( "Attribute Exists", "*[@title]", ["google"] );
         * t( "Attribute Exists", "[@title]", ["google"] );
-        * 
-        * t( "Non-existing part of attribute", "[@name*=bla]", [] ); 
-        * t( "Non-existing start of attribute", "[@name^=bla]", [] ); 
-        * t( "Non-existing end of attribute", "[@name$=bla]", [] ); 
         *
         * t( "Attribute Equals", "a[@rel='bookmark']", ["simon1"] );
         * t( "Attribute Equals", 'a[@rel="bookmark"]', ["simon1"] );
@@ -1732,8 +1731,8 @@ jQuery.extend({
         * t( "Attribute Exists", "//a[@title]", ["google"] );
         * t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );
         * t( "Parent Axis", "//p/..", ["main","foo"] );
-        * t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","sndp","en","sap"] );
-        * t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","sndp","en","sap"] );
+        * t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
+        * t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
         * t( "Has Children", "//p[a]", ["firstp","ap","en","sap"] );
         *
         * t( "nth Element", "p:nth(1)", ["ap"] );
@@ -1904,7 +1903,7 @@ jQuery.extend({
                        return elem[fix[name]];
                } else if( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == 'FORM' && (name == 'action' || name == 'method') ) {
                        return elem.getAttributeNode(name).nodeValue;
-               } else if ( elem.getAttribute != undefined && elem.tagName ) { // IE elem.getAttribute passes even for style
+               } else if ( (jQuery.browser.msie || elem.getAttribute != undefined) && elem.tagName ) { // IE elem.getAttribute passes even for style; Do not "call" elem.getAttribute in IE <- weird crap
                        if ( value != undefined ) elem.setAttribute( name, value );
                        return elem.getAttribute( name );
                } else {