Ticket #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: | ||
| Blocking: | Blocked by: |
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.
Change History
comment:1 Changed 2 years ago by rwaldron
- Owner set to ryanjwilke
- Status changed from new to pending
- Component changed from unfiled to manipulation
comment:2 Changed 2 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'.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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.