From: Jörn Zaefferer Date: Wed, 17 Jan 2007 13:24:44 +0000 (+0000) Subject: Fix for #806 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=3362ccf3ddc20d787551ffdb441ae606a3d06630;p=jquery.git Fix for #806 --- diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 0f1e0f5..28ba007 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -34,7 +34,7 @@ test("get(Number)", function() { test("add(String|Element|Array)", function() { isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" ); - + isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" ); ok( $([]).add($("#form")[0].elements).length > 13, "Check elements from array" ); var x = $([]).add($("

xxx

")).add($("

xxx

")); diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index ca4051f..f756b67 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -985,7 +985,7 @@ jQuery.fn = jQuery.prototype = { add: function(t) { return this.pushStack( jQuery.merge( this.get(), - typeof t == "string" ? jQuery(t).get() : t ) + typeof t == "string" ? jQuery(t).get() : t.length ? t : [t] ) ); },