Skip to main content

Bug Tracker

Side navigation

#9258 closed bug (invalid)

Opened May 12, 2011 06:08PM UTC

Closed May 13, 2011 01:38AM UTC

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

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.

Attachments (0)
Change History (4)

Changed May 12, 2011 06:14PM UTC by rwaldron comment:1

component: unfiledmanipulation
owner: → 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.

Changed May 12, 2011 06:17PM UTC by ajpiano comment:2

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

Changed May 12, 2011 11:39PM UTC by ryanjwilke comment:3

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.

Changed May 13, 2011 01:38AM UTC by ajpiano comment:4

resolution: → invalid
status: newclosed