Fix for #2002
This commit is contained in:
parent
be4a8c32ac
commit
d44e9451f7
|
@ -340,7 +340,7 @@ jQuery.fn = jQuery.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function( selector ) {
|
add: function( selector ) {
|
||||||
return this.pushStack( jQuery.merge(
|
return !selector ? this : this.pushStack( jQuery.merge(
|
||||||
this.get(),
|
this.get(),
|
||||||
selector.constructor == String ?
|
selector.constructor == String ?
|
||||||
jQuery( selector ).get() :
|
jQuery( selector ).get() :
|
||||||
|
|
|
@ -208,8 +208,8 @@ test("get(Number)", function() {
|
||||||
ok( $("p").get(0) == document.getElementById("firstp"), "Get A Single Element" );
|
ok( $("p").get(0) == document.getElementById("firstp"), "Get A Single Element" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("add(String|Element|Array)", function() {
|
test("add(String|Element|Array|undefined)", function() {
|
||||||
expect(7);
|
expect(8);
|
||||||
isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
|
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" );
|
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" );
|
ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
|
||||||
|
@ -221,6 +221,9 @@ test("add(String|Element|Array)", function() {
|
||||||
var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
|
var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
|
||||||
ok( x[0].id == "x1", "Check on-the-fly element1" );
|
ok( x[0].id == "x1", "Check on-the-fly element1" );
|
||||||
ok( x[1].id == "x2", "Check on-the-fly element2" );
|
ok( x[1].id == "x2", "Check on-the-fly element2" );
|
||||||
|
|
||||||
|
var notDefined;
|
||||||
|
equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing." );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("each(Function)", function() {
|
test("each(Function)", function() {
|
||||||
|
|
Loading…
Reference in a new issue