Bug Tracker

Opened 14 years ago

Closed 14 years ago

#3632 closed bug (invalid)

appendTo failes on second call with two targets

Reported by: Citezein Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: appendTo Cc: Citezein
Blocked by: Blocking:


Originally written here: http://groups.google.com/group/jquery-en/browse_thread/thread/b7b6d60f8deac8b4#


$(function() {

var commandLink = $("<span>[Command Link]</span>"); $("#container1").append(commandLink); $(".container").append(commandLink);



<div id='container1' style='background-color: Yellow; padding: 10px;'></div> <div id='container2' class='container' style='background-color: Pink; padding: 10px;'></div> <div id='container3' class='container' style='background-color: Lime; padding: 10px;'></div>

If #container3 exists, all three get the new span added to them. If #container3 is commented out, only #container2 gets the span added.

Both #container1 and #container2 should have the span added when #container3 is not present.

Change History (1)

comment:1 Changed 14 years ago by flesler

Cc: Citezein added
Component: unfilledcore
need: ReviewTest Case
Resolution: invalid
Status: newclosed

I doubt that more than one div would get a span. You're reinserting the same DOM ELEMENT over and over. That means, each time, it is removed from its actual parent and place inside the new one.

If you disagree, provide a test case (html file) clearly showing the problem.

Note: See TracTickets for help on using tickets.