Skip to main content

Bug Tracker

Side navigation

Ticket #1562: extend-1562.diff


File extend-1562.diff, 0.7 KB (added by flesler, May 13, 2008 10:56PM UTC)
Index: core.js
===================================================================
--- core.js	(revision 5588)
+++ core.js	(working copy)
@@ -579,8 +579,11 @@
 					continue;
 
 				// Recurse if we're merging object values
-				if ( deep && copy && typeof copy == "object" && src && !copy.nodeType )
-					target[ name ] = jQuery.extend( deep, src, copy );
+				if ( deep && copy && typeof copy == "object" && !copy.nodeType )
+					target[ name ] = jQuery.extend( deep, 
+						// Never move original objects, clone them
+						src || copy.length !== undefined ? [ ] : { }
+					, copy );
 
 				// Don't bring in undefined values
 				else if ( copy !== undefined )

Download in other formats:

Original Format