Skip to main content

Bug Tracker

Side navigation

#3632 closed bug (invalid)

Opened November 21, 2008 03:43PM UTC

Closed November 25, 2008 11:44AM UTC

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:
Description

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

SCRIPT

$(function() {

var commandLink = $("<span>[Command Link]</span>");

$("#container1").append(commandLink);

$(".container").append(commandLink);

});

HTML

<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.

Attachments (0)
Change History (1)

Changed November 25, 2008 11:44AM UTC by flesler comment:1

cc: → Citezein
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.