Skip to main content

Bug Tracker

Side navigation

#12664 closed bug (fixed)

Opened October 06, 2012 12:07PM UTC

Closed October 16, 2012 08:50PM UTC

Last modified October 29, 2012 04:33PM UTC

.after()

Reported by: msh6180339@gmail.com Owned by: msh6180339@gmail.com
Priority: high Milestone: None
Component: manipulation Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

jQuery 1.8.0, 1.8.1 and 1.8.2: $collection.after($elem) adds $elem to $collection jQuery set.

Attachments (0)
Change History (8)

Changed October 06, 2012 02:06PM UTC by dmethvin comment:1

owner: → msh6180339@gmail.com
status: newpending

Can you provide a test case on jsfiddle.net?

Changed October 07, 2012 07:09AM UTC by Mehdi Shojaei <msh6180339@gmail.com> comment:2

Replying to [comment:1 dmethvin]:

Can you provide a test case on jsfiddle.net?

Hi.

jsfiddle.net test case link:

http://jsfiddle.net/msh6180339/5jkHm/

Thanks a lot.

Changed October 15, 2012 04:33PM UTC by mikesherov comment:3

component: unfiledmanipulation
keywords: → 1.9-discuss
priority: undecidedhigh
status: pendingopen

What should .after() and .before() do to the current set vs. the pushStack set?

Changed October 15, 2012 07:19PM UTC by dmethvin comment:4

As we discussed, the problem is that .after(content) was intended to have two different behaviors:

  • If the first element in the jQuery set is connected to a document, the content is placed after each element in the set, and the **original** set is returned.
  • If the first element in the jQuery set is disconnected, the content is added to the end of a **new** (pushStack()ed) set, and that is returned.

We've had this broken in different ways in different versions. I think we should remove the second behavior and always treat elements the same way.

Changed October 16, 2012 05:57PM UTC by saiwong comment:5

Changed October 16, 2012 08:50PM UTC by Sai Wong comment:6

resolution: → fixed
status: openclosed

Refactored before/after/replaceWith to not pushStack. Fixes #12664, closes gh-987

Changeset: 0c1cea376196d24acc73c64dbdff1880a2dfd006

Changed October 16, 2012 09:44PM UTC by mehdishojaei comment:7

I think this refactoring makes before/after/replaceWith more obvious and cause them to work more naturally.

Thank you all.

Changed October 29, 2012 04:33PM UTC by dmethvin comment:8

keywords: 1.9-discuss