X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=ba5d7f5288aa0f753b82bd959afc2d4eb1893625;hb=9e06903a99caf5619d0db858ed3d24f0e6ee15db;hp=34bab952d0c8c4ba4ef7412a38251b9e35a5dc19;hpb=cb65daa399630de0cdcd81af55ff76f6cd93da62;p=jquery.git diff --git a/src/core.js b/src/core.js index 34bab95..ba5d7f5 100644 --- a/src/core.js +++ b/src/core.js @@ -197,7 +197,14 @@ jQuery.fn = jQuery.prototype = { // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set - var ret = jQuery( elems || null ); + var ret = jQuery(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } // Add the old object onto the stack (as a reference) ret.prevObject = this; @@ -214,18 +221,6 @@ jQuery.fn = jQuery.prototype = { return ret; }, - // Force the current matched set of elements to become - // the specified array of elements (destroying the stack in the process) - // You should use pushStack() in order to do this, but maintain the stack - setArray: function( elems ) { - // Resetting the length to 0, then using the native Array push - // is a super-fast way to populate an object with array-like properties - this.length = 0; - push.apply( this, elems ); - - return this; - }, - // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) @@ -485,6 +480,9 @@ jQuery.extend({ if ( typeof data !== "string" || !data ) { return null; } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js @@ -801,7 +799,7 @@ function access( elems, key, value, exec, fn, pass ) { } // Getting an attribute - return length ? fn( elems[0], key ) : null; + return length ? fn( elems[0], key ) : undefined; } function now() {