Commit 3362ccf3 authored by Jörn Zaefferer's avatar Jörn Zaefferer

Fix for #806

parent 53e12752
......@@ -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($("<p id='x1'>xxx</p>")).add($("<p id='x2'>xxx</p>"));
......
......@@ -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] )
);
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment