Bug Tracker

Opened 5 years ago

Closed 5 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 5 years ago by rwaldron

  • Component changed from unfiled to manipulation
  • Owner set to ryanjwilke
  • Status changed from new to pending

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 5 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 5 years ago by ryanjwilke

  • Status changed from pending to new

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 5 years ago by ajpiano

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.