X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2Fjquery.js;h=ff33034ede6ff512a4f6aac2e796bb891ef06b34;hb=887c00780df75ab42228285e4571b9052e6fd51a;hp=8420525376a58f1c2d47f5b8c3d8aef7cc9f5d6c;hpb=735e2e8197e391c2666766d2b2ba924fe5fb73d8;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 8420525..ff33034 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1160,6 +1160,10 @@ jQuery.fn = jQuery.prototype = { ( this.length ? this[0].innerHTML : null ) : this.empty().append( val ); }, + + slice: function() { + return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); + }, /** * @private @@ -1252,17 +1256,33 @@ jQuery.fn = jQuery.prototype = { */ jQuery.extend = jQuery.fn.extend = function() { // copy reference to target object - var target = arguments[0], a = 1; + var target = arguments[0] || {}, a = 1, al = arguments.length; // extend jQuery itself if only one argument is passed - if ( arguments.length == 1 ) { + if ( al == 1 ) { target = this; a = 0; } + var prop; - while ( (prop = arguments[a++]) != null ) - // Extend the base object - for ( var i in prop ) target[i] = prop[i]; + + for ( ; a < al; a++ ) + // Only deal with non-null/undefined values + if ( (prop = arguments[a]) != null ) + // Extend the base object + for ( var i in prop ) { + // Prevent never-ending loop + if ( target == prop[i] ) + continue; + + // Recurse if we're merging object values + if ( typeof prop[i] == 'object' && target[i] ) + jQuery.extend( target[i], prop[i] ); + + // Don't bring in undefined values + else if ( prop[i] != undefined ) + target[i] = prop[i]; + } // Return the modified object return target; @@ -1577,7 +1597,11 @@ jQuery.extend({ [3, "", "
"] || !s.indexOf("", ""] || + [2, "", "
"] || + + // IE can't serialize and