Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9258 closed bug (invalid)

clone() working with insertAfter(), but not after()

Reported by: ryanjwilke Owned by: ryanjwilke
Priority: undecided Milestone: 1.next
Component: manipulation Version: 1.6
Keywords: Cc:
Blocked by: Blocking:


When running this code, I found this bug:

This doesn't work $(this).parent().clone().after($(this).parent());

This works $(this).parent().clone().insertAfter($(this).parent());

From the description in the docs, both should work.

Change History (4)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledmanipulation
Owner: set to ryanjwilke
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.

comment:2 Changed 12 years ago by ajpiano

Also, please provide some more illumination as to why you think this is a bug. Those two methods are not designed to work the exact same way. The former should insert the parent element of 'this' "after" the clone - which is nowhere, because the clone isn't in the DOM. The latter is designed to actually insert the clone into the DOM at a specified location - after the parent of 'this'.

comment:3 Changed 12 years ago by ryanjwilke

Status: pendingnew

Ahhh, thanks for pointing that out. I must have been confused mainly by the line: "The .after() and .insertAfter() methods perform the same task."

Maybe I took that too literally.

Thanks for the help though.

comment:4 Changed 12 years ago by ajpiano

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