Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13462 closed bug (duplicate)

Problem with append in 1.9.1

Reported by: nhuon Owned by:
Priority: undecided Milestone: None
Component: manipulation Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

There seems to be a problem with chaining elements when I do the following:

$(".a").append($("<div>B</div>").after("<span>C</span>"));

C is not inserted after B like I would expect. This was working with 1.8.3, but not anymore in 1.9.1

http://jsfiddle.net/nhuon/gfGyR/

Change History (1)

comment:1 Changed 7 years ago by gibson042

Component: unfiledmanipulation
Resolution: duplicate
Status: newclosed

Duplicate of #12982.
Per the 1.9 upgrade guide, .before, .after, and .replaceWith no longer have any effect when executed against collections consisting only of disconnected nodes.

The old behavior of .after on disconnected nodes (altering the jQuery collection instead of the DOM) is still available with .add, but it looks like your intended results can be achieved without either: http://jsfiddle.net/gfGyR/1/

Note: See TracTickets for help on using tickets.