Fix for #1087: Using appendTo with select elements
This commit is contained in:
parent
2897b1bd23
commit
cb828f3dab
2 changed files with 8 additions and 4 deletions
6
src/jquery/coreTest.js
vendored
6
src/jquery/coreTest.js
vendored
|
@ -356,7 +356,7 @@ test("wrap(String|Element)", function() {
|
|||
});
|
||||
|
||||
test("append(String|Element|Array<Element>|jQuery)", function() {
|
||||
expect(12);
|
||||
expect(13);
|
||||
var defaultText = 'Try them out:'
|
||||
var result = $('#first').append('<b>buga</b>');
|
||||
ok( result.text() == defaultText + 'buga', 'Check if text appending works' );
|
||||
|
@ -404,6 +404,10 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
|
|||
|
||||
ok( pass, "Test for appending a DOM node to the contents of an IFrame" );
|
||||
|
||||
reset();
|
||||
$('#select1').appendTo('#foo');
|
||||
t( 'Append select', '#foo select', ['select1'] );
|
||||
|
||||
});
|
||||
|
||||
test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
||||
|
|
6
src/jquery/jquery.js
vendored
6
src/jquery/jquery.js
vendored
|
@ -1525,10 +1525,10 @@ jQuery.extend({
|
|||
arg = jQuery.makeArray( div.childNodes );
|
||||
}
|
||||
|
||||
if ( arg.length === 0 && !jQuery.nodeName(arg, "form") )
|
||||
if ( arg.length === 0 && !jQuery(arg).is("form, select") )
|
||||
return;
|
||||
|
||||
if ( arg[0] == undefined || jQuery.nodeName(arg, "form") )
|
||||
|
||||
if ( arg[0] == undefined || jQuery(arg).is("form, select") )
|
||||
r.push( arg );
|
||||
else
|
||||
r = jQuery.merge( r, arg );
|
||||
|
|
Loading…
Reference in a new issue