aboutsummaryrefslogtreecommitdiffstats
path: root/src/jquery/jquery.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-08-19 23:37:26 +0000
committerJohn Resig <jeresig@gmail.com>2007-08-19 23:37:26 +0000
commit2ef4093cf7f52383dd43bd361864edcda27e5c3c (patch)
tree13ff931a06c6d508829377cb809e497ffaa8ab19 /src/jquery/jquery.js
parent24db022ba06523f92e94ac5fa791fc4865b55ba7 (diff)
downloadjquery-2ef4093cf7f52383dd43bd361864edcda27e5c3c.tar.gz
jquery-2ef4093cf7f52383dd43bd361864edcda27e5c3c.zip
Complete overhaul of the Ajax test suite, it's now passing in all browsers. In order to achieve this I had to fix a numbe
r of bugs in the suite itself, along with other random bugs that popped up. The following bugs were resolved along the wa y: #1236 (.extend() keeps processing when it hits nulls), #1028 (.extend() now works recursively), #1080 ($.get no longer overwrites the data parameter), #1210 (Creating script and link tags now work), and #1463 (jQuery.global has been re-too led to no longer leak memory and slow things down).
Diffstat (limited to 'src/jquery/jquery.js')
-rw-r--r--src/jquery/jquery.js34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 98cbf372e..b7091e26f 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1252,17 +1252,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 +1593,11 @@ jQuery.extend({
[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
!s.indexOf("<col") &&
- [2, "<table><colgroup>", "</colgroup></table>"] ||
+ [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
+
+ // IE can't serialize <link> and <script> tags normally
+ jQuery.browser.msie &&
+ [1, "div<div>", "</div>"] ||
[0,"",""];
@@ -1586,7 +1606,7 @@ jQuery.extend({
// Move to the right depth
while ( wrap[0]-- )
- div = div.firstChild;
+ div = div.lastChild;
// Remove IE's autoinserted <tbody> from table fragments
if ( jQuery.browser.msie ) {