Skip to main content

Bug Tracker

Side navigation

#6986 closed bug (invalid)

Opened September 02, 2010 03:14AM UTC

Closed September 02, 2010 04:30PM UTC

append() and appendTo() not functionally equivalent

Reported by: josho Owned by:
Priority: Milestone: 1.4.3
Component: manipulation Version: 1.4.2
Keywords: append appendTo Cc:
Blocked by: Blocking:
Description

this is a case where append() and appendTo() are not functionally equivalent.

this happens when appending a jQuery object from an array of jQuery objects, and potentially other collections. i'm not entirely sure if this is a bug or not; i can't make up my mind.

var stack = [

$('<div />')

, $('<div />')

, $('<div />')

];

does not work

$('#target').append($(stack));

works

$(stack).appendTo('#target');

Attachments (0)
Change History (3)

Changed September 02, 2010 03:16AM UTC by josho comment:1

edit: goddamnit trac, formatted for her pleasure

var stack = [
	  $('<div />')
	, $('<div />')
	, $('<div />')
];

// does not work
$('#target').append($(stack));

// works
$(stack).appendTo('#target');

Changed September 02, 2010 03:21AM UTC by dmethvin comment:2

Well for one thing, an array passed to $() should be an array of DOM elements. There is no jQuery() signature that takes an array of jQuery objects.

Changed September 02, 2010 04:30PM UTC by dmethvin comment:3

resolution: → invalid
status: newclosed