X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=53ffc16e16e8e770b4a730e49d20bd06604f35f6;hb=d6ab3c71ac49f370367f28e0bdf433c173adbdb1;hp=03db89cb1f5d91fbfbad55f6d8eefb4b88f2940c;hpb=83b0e17f3fc1b0ed9993827d2308c344392926d4;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 03db89c..53ffc16 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -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() == [

...

] * * @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() ); }, @@ -1469,7 +1472,7 @@ jQuery.extend({ if ( p == "height" || p == "width" ) { var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; - for ( var i in d ) { + for ( var i=0; iHello

Hello Again

And Again

* @result [
Hello
] * @@ -3315,8 +3318,8 @@ jQuery.macros = { }, /** - * Adds the specified class if it is present, removes it if it is - * not present. + * Adds the specified class if it is not present, removes it if it is + * present. * * @example $("p").toggleClass("selected") * @before

Hello

Hello Again