Bug Tracker

Opened 12 years ago

Closed 12 years ago

#6986 closed bug (invalid)

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:


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');

Change History (3)

comment:1 in reply to:  description Changed 12 years ago by josho

edit: goddamnit trac, formatted for her pleasure

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

// does not work

// works

comment:2 Changed 12 years ago by dmethvin

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.

comment:3 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.