Skip to main content

Bug Tracker

Side navigation

Ticket #2510: core-merge.patch
File core-merge.patch, 0.9 KB (added by diego, March 29, 2008 10:56PM UTC)
--- core.js.orig	2008-03-29 14:48:25.000000000 +0100
+++ core.js	2008-03-29 14:56:57.000000000 +0100
@@ -1144,16 +1144,21 @@
 
 		// Also, we need to make sure that the correct elements are being returned
 		// (IE returns comment nodes in a '*' query)
-		if ( jQuery.browser.msie ) {
-			for ( var i = 0; second[ i ]; i++ )
-				if ( second[ i ].nodeType != 8 )
-					first.push( second[ i ] );
-
-		} else
-			for ( var i = 0; second[ i ]; i++ )
-				first.push( second[ i ] );
-
-		return first;
+		jQuery.merge = jQuery.browser.msie ?
+			function( first, second ) {
+				var a, i = -1;
+				while (a = second[++i])
+					if ( a.nodeType != 8 )
+						first[first.length] = a;
+				return first;
+			} :
+			function( first, second ) {
+				var a, i = -1;
+				while (a = second[++i])
+					first[first.length] = a;
+				return first;
+			};
+		return jQuery.merge( first, second );
 	},
 
 	unique: function( array ) {

Download in other formats:

Original Format